zzr99
2022-07-08 6fa59de585fcd153e54c129f10f91a2ce34afaaa
WebTM/views/²Ö´æ¹ÜÀí/²Ö¿âµ÷²¦/Kf_MoveStockBill_Fast.html
@@ -1,13 +1,18 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>调拨单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <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,9 @@
                            <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>
                    <div class="layui-tab layui-col-xs12" lay-filter="tab-MoveStockBill">
@@ -34,7 +42,7 @@
                            <li lay-id="2" style="padding:1px;">表头信息</li>
                            <li lay-id="3" style="padding:1px;">明细信息</li>
                            <li lay-id="4" style="padding:1px;">库存信息</li>
                            <li lay-id="5" style="padding:1px;min-width: 35px;" ">汇总</li>
                            <li lay-id="5" style="padding:1px;min-width: 35px;">汇总</li>
                        </ul>
                        <div class="layui-tab-content">
                            <!--选择源单-->
@@ -50,21 +58,11 @@
                                                <option value="3720">生产任务单-投料</option>
                                                <option value="1243">调拨申请单</option>
                                                <!--<option value="1201">委外订单-投料</option>
                                <option value="1402">发货通知单</option>
                                <option value="1234">下架通知单</option>
                                <option value="1243">调拨申请单</option>-->
                    <option value="1402">发货通知单</option>
                    <option value="1234">下架通知单</option>
                    <option value="1243">调拨申请单</option>-->
                                            </select>
                                            <!--<input type="text" name="cmbSourceType" id="cmbSourceType" lay-verify="cmbSourceType" autocomplete="off" class="layui-input">-->
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <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">
                                            <input type="text" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                </div>
@@ -122,6 +120,19 @@
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <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">
                                            <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>
                            </div>
                            <!--表头信息-->
                            <div class="layui-tab-item">
@@ -149,7 +160,7 @@
                                            <input type="hidden" name="HStockPlaceID" id="HStockPlaceID" lay-verify="HStockPlaceID" value="0" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-col-xs3">
                                            <button type="button" id="HSpID-BT" lay-submit="" class="layui-btn" lay-filter="HSpID-BT" style="display:none">...</button>
                                            <button type="button" id="HSpID-BT" lay-submit="" class="layui-btn" lay-filter="HSpID-BT">...</button>
                                        </div>
                                    </div>
                                </div>
@@ -177,7 +188,7 @@
                                            <input type="hidden" name="HOutStockPlaceID" id="HOutStockPlaceID" lay-verify="HOutStockPlaceID" value="0" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-col-xs3">
                                            <button type="button" id="HOSpID-BT" lay-submit="" class="layui-btn" lay-filter="HOSpID-BT" style="display:none">...</button>
                                            <button type="button" id="HOSpID-BT" lay-submit="" class="layui-btn" lay-filter="HOSpID-BT">...</button>
                                        </div>
                                    </div>
                                </div>
@@ -371,10 +382,13 @@
            $("#HBarCode").focus();
            //表头初始化赋值(根据登录用户获取 é»˜è®¤ä»“库、部门、验收、保管、金蝶用户) new
            $("#HSCWHID").val(sessionStorage["HWHID"]);
            $("#HSCWHNAME").val(sessionStorage["HWHName"]);
            $("#HOutStockPlaceID").val(sessionStorage["HSPID"]);
            $("#HOutStockPlaceName").val(sessionStorage["HSPName"]);
            //$("#HSCWHID").val(sessionStorage["HWHID"]);
           // $("#HSCWHNAME").val(sessionStorage["HWHName"]);
            //$("#HOutStockPlaceID").val(sessionStorage["HSPID"]);
            //$("#HOutStockPlaceName").val(sessionStorage["HSPName"]);
            $("#HDeptID").val(sessionStorage["HDeptID"]);
            $("#HDeptName").val(sessionStorage["HDept"]);
            $("#HSecManagerID").val(sessionStorage["HSecManagerID"]);
@@ -394,12 +408,14 @@
            $("#HStockInOrgName").val(sessionStorage["Organization"]);
            var HSourceFlag = sessionStorage["SourceFlag"];
            //判断是否登录 æœªç™»å½•则跳到登录页
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { window.location.href = "../../user/login.html"; });
            }
            //if (sessionStorage.login != "login") {
            //    layer.confirm("登录失效,请重新登录!", {
            //        icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
            //    }, function () { window.location.href = "../../user/login.html"; });
            //}
            //获取参数
            function getUrlVars() {
@@ -479,7 +495,7 @@
                $("#HInterID").val("");
                $("#HBillNo").val("");
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    url: GetWEBURL() + "/Web/GetMAXNumPDA",
                    type: "GET",
                    data: { "HBillType": '1207' },
                    success: function (d) {
@@ -547,8 +563,23 @@
            });
            //选择调入仓位
            form.on('submit(HSpID-BT)', function () {//选择调入仓位
            //form.on('submit(HSpID-BT)', function () {//选择调入仓位
            //    layer.open({
            //        type: 2
            //        , area: ['100%', '100%']
            //        , title: '仓位列表'
            //        , shade: 0.6 //遮罩透明度
            //        , maxmin: true //允许全屏最小化
            //        , anim: 0 //0-6的动画形式,-1不开启
            //        , content: ['../../../views/Baseset/基础资料/Gy_StockPlaceListNew.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HSpID&HOrgID=HStockInOrgID', 'yes']
            //        , resize: false
            //        , cancel: function () {
            //        }
            //    })
            //});
            form.on('submit(HSpID-BT)', function () {//选择仓位
                layer.open({
                    type: 2
                    , area: ['100%', '100%']
@@ -556,9 +587,10 @@
                    , shade: 0.6 //遮罩透明度
                    , maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../../views/Baseset/基础资料/Gy_StockPlaceListNew.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HSpID&HOrgID=HStockInOrgID', 'yes']
                    , content: ['../../../views/Baseset/基础资料/Gy_StockPlaceList.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HSpID', 'yes']
                    , resize: false
                    , cancel: function () {
                        //$(".layui-btn").removeClass("layui-btn-disabled");
                    }
                })
            });
@@ -582,7 +614,23 @@
            });
            //选择调出仓位
            form.on('submit(HOSpID-BT)', function () {//选择调出仓位
            //form.on('submit(HOSpID-BT)', function () {//选择调出仓位
            //    layer.open({
            //        type: 2
            //        , area: ['100%', '100%']
            //        , title: '仓位列表'
            //        , shade: 0.6 //遮罩透明度
            //        , maxmin: true //允许全屏最小化
            //        , anim: 0 //0-6的动画形式,-1不开启
            //        , content: ['../../../views/Baseset/基础资料/Gy_StockPlaceListNew.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HOSpID&HOrgID=HStockOutOrgID', 'yes']
            //        , resize: false
            //        , cancel: function () {
            //            //$(".layui-btn").removeClass("layui-btn-disabled");
            //        }
            //    })
            //});
            form.on('submit(HOSpID-BT)', function () {//选择仓位
                layer.open({
                    type: 2
                    , area: ['100%', '100%']
@@ -590,7 +638,7 @@
                    , shade: 0.6 //遮罩透明度
                    , maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../../views/Baseset/基础资料/Gy_StockPlaceListNew.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HOSpID&HOrgID=HStockOutOrgID', 'yes']
                    , content: ['../../../views/Baseset/基础资料/Gy_StockPlaceList.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HOSpID', 'yes']
                    , resize: false
                    , cancel: function () {
                        //$(".layui-btn").removeClass("layui-btn-disabled");
@@ -797,8 +845,11 @@
            //退出按钮
            form.on('submit(Cancel)', function () {
                parent.location.href = "../../../views/index.html"
                //parent.location.href = "../../../views/index.html"
                //window.close();//关闭当前页
                layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                    window.close();
                });
            })
            //提交
@@ -819,7 +870,7 @@
                            dataType: "json",
                            success: function (data) {
                                if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†
                                    layer.confirm("生成调拨单" + data.Message + $("#HBillNo").val(), {
                                    layer.confirm(data.Message , {
                                        icon: 1, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['新增'],
                                        btn2: function () {
                                            //parent.layui.admin.events.closeThisTabs();关闭页签
@@ -854,283 +905,28 @@
            //扫条码
            $('#HBarCode').on('keydown', function (event) {  //扫条码
                var sOldBarCode = $('#HBarCode').val()
                var HDeleteFlag = sOldBarCode.substring(0, 1);
                var sBarCode = sOldBarCode.slice(1);
                var sSubStr = table.cache['wl-table'];
                //var sBarCode = $('#HBarCode').val()
                var sInterID = $("#HInterID").val()
                var sBillNo = $("#HBillNo").val()
                var sQty = $("#HQty").val()
                var sHBillType = $("#HBillType").val()
                var SCWhID = $("#HSCWHID").val()//调出仓库
                var HSPID = $("#HStockPlaceID").val()//调入仓位
                var HWHID = $("#HWHID").val()//调入仓库
                var SCSPID = $("#HOutStockPlaceID").val()//调出仓位
                var HMaker = $("#HMaker").val();//制单人
                var HOrgID = $("#HOrgID").val();//组织
                var sBillType = '1207';
                var sSourceBillNo = $("#HSourceBillNo").val();//源单号
                if (sSourceBillNo == null)
                {
                    sSourceBillNo = "";
                }
                if (sQty == "") {
                    sQty = 0;
                }
            $('#HBarCode').on('keydown', function (event) {
                var sQty = $("#HQty").val();
                if (event.keyCode == 13) {
                    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) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†
                                        table.render({
                                            elem: '#wl-table'
                                            , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
                                            , toolbar: '#toolbarDemo'
                                            , defaultToolbar: []
                                            , where: { HBillID: sInterID, HBillType: '1207', 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 }
                                                , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                                            ]]
                                            // , data: [linterid]
                                            // , page: true
                                            , height: 500
                                            , done: function () {
                                                layer.closeAll("loading");
                                            }
                                        })
                                    }
                                    else {
                                        layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                    }
                                },
                                error: function (err) {
                                    layer.msg('错误' + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                }
                            });
                    }
                    else {
                        var sBarCode = $('#HBarCode').val()
                        if (sBarCode != "") {
                            $('#HBarCode').val("");
                        }
                        if (sQty != "") {
                            $('#HQty').val("");
                        }
                        if ($("#HWHNAME").val() == '') {
                            playSound();
                            layer.msg("调入仓库没有选择!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                        }
                        //if ($("#HWHID").val() == $("#HSCWHID").val() && $("#HStockPlaceID").val() == $("#HOutStockPlaceID").val()) {
                        //    layer.msg("调入仓库、仓位不能和调出仓库、仓位都相同!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        //    return false;
                        //}
                        //if ($("#HSCWHNAME").val() == '') {
                        //    layer.msg("调出仓库没有选择!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        //    return false;
                        //}
                        if ($("#HBillNo").val() == '') {
                            playSound();
                            layer.msg("错误的单据号!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                        }
                        if ($("#HInterID").val() == '') {
                            playSound();
                            layer.msg("错误的内码!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                        }
                        $.ajax({
                            url: GetWEBURL() + "/MoveStockBill/get_InfoByBarCode_Source_Json",
                            type: "GET",
                            data: { "sCode": sBarCode, "sInterID": sInterID, "sBillNo": sBillNo, "sQty": sQty, "HWHID": HWHID, "HSPID": HSPID, "SCWhID": SCWhID, "SCSPID": SCSPID, "HMaker": HMaker, "HOrgID": HOrgID, "HSourceBillNo": sSourceBillNo, "HSourceBillType":  sHBillType },
                            success: function (result) {
                                if (result.count == 1) {
                                    element.tabChange('tab-MoveStockBill', '3');
                                    //$("#HWHNAME").attr("readOnly", "true");//调入仓库不可变
                                    //$("#HWHID-BT").attr("disabled", "true");
                                    //$("#HStockPlaceName").attr("readOnly", "true");//调入仓位不可变
                                    //$("#HSpID-BT").attr("disabled", "true");
                                    //$("#HSCWHNAME").attr("readOnly", "true");//调出仓库不可变
                                    //$("#HSCWHID-BT").attr("disabled", "true");
                                    //$("#HOutStockPlaceName").attr("readOnly", "true");//调入仓位不可变
                                    //$("#HOSpID-BT").attr("disabled", "true");
                                    layer.load(3)
                                    table.render({
                                        elem: '#wl-table'
                                        , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
                                        , toolbar: '#toolbarDemo'
                                        , defaultToolbar: []
                                        , totalRow: true
                                        , where: { HBillID: sInterID, HBillType: '1207', sWhere: '' }
                                        , cols: [[
                                            { type: 'radio', totalRowText: '合计' }
                                            , { field: 'HQty', title: '数量', width: 150, totalRow: true }
                                            , { field: '件数', title: '件数', width: 150, totalRow: true }
                                            , { 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: 'HMaterID', title: '物料内码', width: 150, hide: true }
                                            , { field: 'HAuxPropID', title: '', width: 150, hide: true }
                                            , { field: 'HMTONo', title: '计划跟踪号', width: 150, hide: true }
                                            , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                                        ]]
                                        // , data: [linterid]
                                        // , page: true
                                        //, height: 500
                                        , done: function () {
                                            layer.closeAll("loading");
                                        }
                                    });
                                    playSound1();
                                    var sSubStr = table.cache['wl-table'];
                                }
                                else {
                                    playSound();
                                    layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                }
                                layer.closeAll("loading");
                            }
                            //,
                            //error: function (XMLHttpRequest, textStatus, errorThrown) {
                            //    alert("请求对象XMLHttpRequest: " + XMLHttpRequest);
                            //    alert("错误类型textStatus: " + textStatus);
                            //    alert("异常对象errorThrown: " + errorThrown);
                            //}
                        });
                    }
                    GetMeesageByBarCode();
                }
            });
            //确定
            form.on('submit(QueDin)', function (data) {
                GetMeesageByBarCode();
            });
            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();
            }
            //扫源单
            $('#HSourceBillNo').on('keydown', function (event) {      //扫源单
                var HSourceBillNo = $('#HSourceBillNo').val()
                var sInterID = $("#HInterID").val()
                var sBillNo = $("#HBillNo").val()
                var HSourceBillType = $("#HBillType").val()
                if (HSourceBillType == '1243')
                {
                }
                if (event.keyCode == 13) {
                    $.ajax({
                        url: GetWEBURL() + "/MoveStockBill/set_SavePonderationBillMain_Temp_Source_Fast_Json",
                        type: "GET",
                        data: { "HSourceBillType": HSourceBillType, "HSourceBillNo": HSourceBillNo, "sInterID": sInterID, "sBillNo": sBillNo },
                        success: function (result) {
                            if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                if (result.data[0].HSourceBillType == '1243')
                                {
                                    $("#HStockStyle").val(result.data[0].HStockStyle);
                                    $("#HStockInOrgID").val(result.data[0].HSTOCKINORGID);
                                    $("#HStockInOrgName").val(result.data[0].HSTOCKINORGName);
                                    $("#HStockOutOrgID").val(result.data[0].HSTOCKOUTORGID);
                                    $("#HStockOutOrgName").val(result.data[0].HSTOCKOUTORGName);
                                }
                                $("#HDeptID").val(result.data[0].HDeptID);
                                $("#HDeptName").val(result.data[0].HDeptName);
                                $("#HWHID").val(result.data[0].HWhID);
                                $("#HWHNAME").val(result.data[0].HWhName);
                                //if (!DBUtility.ClsPub.ObjToBool(DS.Tables[0].Rows[0]["HIsStockMgr"])) {
                                //    $("#HStockPlaceName").Enabled = false;
                                //    $("#HStockPlaceID").Enabled = false;
                                //}
                                //else {
                                //    $("#HStockPlaceName").Enabled = true;
                                //    $("#HStockPlaceID").Enabled = true;
                                //}
                                layer.load(3);
                                element.tabChange('tab-MoveStockBill', '2');
                                table.render({
                                    elem: '#wl-table'
                                    , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
                                    , toolbar: '#toolbarDemo'
                                    , defaultToolbar: []
                                    , where: { HBillID: sInterID, HBillType: '1207', 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 }
                                        , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                                    ]]
                                    // , data: [linterid]
                                    // , page: true
                                    , height: 500
                                    , done: function () {
                                        layer.closeAll("loading");
                                    }
                                });
                            }
                            else {
                                layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            }
                            layer.closeAll("loading");
                        }
                    });
                    GetMeesageBySourceBillNo();
                }
            });
            //确定
            form.on('submit(QueDin2)', function (data) {
                GetMeesageBySourceBillNo();
            });
            $('#HStockPlaceName').on('keydown', function (event) {      //扫仓位
@@ -1216,39 +1012,297 @@
                }
            });
            //扫条码
            function GetMeesageByBarCode(obj) {  //返回工作中心
                var sOldBarCode = $('#HBarCode').val()
                var HDeleteFlag = sOldBarCode.substring(0, 1);
                var sBarCode = sOldBarCode.slice(1);
            //以上为layui模块
                var sSubStr = table.cache['wl-table'];
                //var sBarCode = $('#HBarCode').val()
                var sInterID = $("#HInterID").val()
                var sBillNo = $("#HBillNo").val()
                var sQty = $("#HQty").val()
                var sHBillType = $("#HBillType").val()
                var HSCWhID = $("#HSCWHID").val()//调出仓库
                var HSCSPID = $("#HOutStockPlaceID").val()//调出仓位
                var SPID = $("#HStockPlaceID").val()//调入仓位
                var WhID = $("#HWHID").val()//调入仓库
                var sMaker = $("#HMaker").val();//制单人
                var HOrgID = $("#HOrgID").val();//组织
                var HBillType = '1207';
                var sSourceBillNo = $("#HSourceBillNo").val();//源单号
                if (sSourceBillNo == null) {
                    sSourceBillNo = "";
                }
                var HScanStyle = "";
                var HStockOutOrgID = $("#HStockOutOrgID").val()//调出组织
                var HStockInOrgID = $("#HStockInOrgID").val()//调入组织
                if (sQty == "") {
                    sQty = 0;
                }
                //if (WhID == HSCWhID)
                //{
                //    layer.msg("调入仓库跟调出仓库一致,请重新选择调入仓库或者调出仓库!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //    return false;
                //}
                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.render({
                                        elem: '#wl-table'
                                        , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
                                        , toolbar: '#toolbarDemo'
                                        , totalRow: true
                                        , defaultToolbar: []
                                        , where: { HBillID: sInterID, HBillType: '1207', sWhere: '' }
                                        , cols: [[
                                            { type: 'radio' }
                                            , { field: 'HQty', title: '数量', width: 150, totalRow: true}
                                            , { field: 'HQtyMust', title: '应收数量', width: 150, totalRow: true}
                                            , { 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 }
                                            , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                                        ]]
                                        // , data: [linterid]
                                        // , page: true
                                        , height: 500
                                        , done: function () {
                                            layer.closeAll("loading");
                                        }
                                    })
                                }
                                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 != "") {
                        $('#HBarCode').val("");
                    }
                    if (sQty != "") {
                        $('#HQty').val("");
                    }
                    if ($("#HWHNAME").val() == '') {
                        playSound();
                        layer.msg("调入仓库没有选择!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        return false;
                    }
                    //if ($("#HWHID").val() == $("#HSCWHID").val() && $("#HStockPlaceID").val() == $("#HOutStockPlaceID").val()) {
                    //    layer.msg("调入仓库、仓位不能和调出仓库、仓位都相同!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    //    return false;
                    //}
                    //if ($("#HSCWHNAME").val() == '') {
                    //    layer.msg("调出仓库没有选择!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    //    return false;
                    //}
                    if ($("#HBillNo").val() == '') {
                        playSound();
                        layer.msg("错误的单据号!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        return false;
                    }
                    if ($("#HInterID").val() == '') {
                        playSound();
                        layer.msg("错误的内码!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        return false;
                    }
                    $.ajax({
                        url: GetWEBURL() + "/MoveStockBill/get_InfoByBarCode_Source_Json",//37181
                        type: "GET",
                        data: { "sCode": sBarCode, "sInterID": sInterID, "HBillType": HBillType, "sBillNo": sBillNo, "sMaker": sMaker, "WhID": WhID, "SPID": SPID, "HSCWhID": HSCWhID, "HSCSPID": HSCSPID, "sQty": sQty, "SourceFlag": sessionStorage["SourceFlag"], "sSourceBillNo": sSourceBillNo, "sHSourceBillType": sHBillType, "HStockInOrgID": HStockInOrgID, "HStockOutOrgID": HStockOutOrgID, "HScanStyle": HScanStyle},
                        success: function (result) {
                            if (result.count == 1) {
                                element.tabChange('tab-MoveStockBill', '3');
                                //$("#HWHNAME").attr("readOnly", "true");//调入仓库不可变
                                //$("#HWHID-BT").attr("disabled", "true");
                                //$("#HStockPlaceName").attr("readOnly", "true");//调入仓位不可变
                                //$("#HSpID-BT").attr("disabled", "true");
                                //$("#HSCWHNAME").attr("readOnly", "true");//调出仓库不可变
                                //$("#HSCWHID-BT").attr("disabled", "true");
                                //$("#HOutStockPlaceName").attr("readOnly", "true");//调入仓位不可变
                                //$("#HOSpID-BT").attr("disabled", "true");
                                layer.load(3)
                                table.render({
                                    elem: '#wl-table'
                                    , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
                                    , toolbar: '#toolbarDemo'
                                    , defaultToolbar: []
                                    , totalRow: true
                                    , where: { HBillID: sInterID, HBillType: '1207', sWhere: '' }
                                    , cols: [[
                                        { type: 'radio', totalRowText: '合计' }
                                        , { field: 'HQty', title: '数量', width: 150, totalRow: true }
                                        , { field: '件数', title: '件数', width: 150, totalRow: true }
                                        , { 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: 'HMaterID', title: '物料内码', width: 150, hide: true }
                                        , { field: 'HAuxPropID', title: '', width: 150, hide: true }
                                        , { field: 'HMTONo', title: '计划跟踪号', width: 150, hide: true }
                                        , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                                    ]]
                                    // , data: [linterid]
                                    // , page: true
                                    //, height: 500
                                    , done: function () {
                                        layer.closeAll("loading");
                                    }
                                });
                                playSound1();
                                var sSubStr = table.cache['wl-table'];
                            }
                            else {
                                playSound();
                                layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            }
                            layer.closeAll("loading");
                        }
                        //,
                        //error: function (XMLHttpRequest, textStatus, errorThrown) {
                        //    alert("请求对象XMLHttpRequest: " + XMLHttpRequest);
                        //    alert("错误类型textStatus: " + textStatus);
                        //    alert("异常对象errorThrown: " + errorThrown);
                        //}
                    });
                }
            }
            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()
                $.ajax({
                    url: GetWEBURL() + "/MoveStockBill/set_SavePonderationBillMain_Temp_Source_Fast_Json",
                    type: "GET",
                    data: { "HSourceBillType": HSourceBillType, "HSourceBillNo": HSourceBillNo, "sInterID": sInterID, "sBillNo": sBillNo },
                    success: function (result) {
                        if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            playSound1();
                            HSourceFlag = true;
                            if (result.data[0].HSourceBillType == '1243') {
                                $("#HStockStyle").val(result.data[0].HStockStyle);
                                $("#HStockInOrgID").val(result.data[0].HSTOCKINORGID);
                                $("#HStockInOrgName").val(result.data[0].HSTOCKINORGName);
                                $("#HStockOutOrgID").val(result.data[0].HSTOCKOUTORGID);
                                $("#HStockOutOrgName").val(result.data[0].HSTOCKOUTORGName);
                            }
                            $("#HDeptID").val(result.data[0].HDeptID);
                            $("#HDeptName").val(result.data[0].HDeptName);
                            $("#HWHID").val(result.data[0].HWhID);
                            $("#HWHNAME").val(result.data[0].HWhName);
                            //if (!DBUtility.ClsPub.ObjToBool(DS.Tables[0].Rows[0]["HIsStockMgr"])) {
                            //    $("#HStockPlaceName").Enabled = false;
                            //    $("#HStockPlaceID").Enabled = false;
                            //}
                            //else {
                            //    $("#HStockPlaceName").Enabled = true;
                            //    $("#HStockPlaceID").Enabled = true;
                            //}
                            layer.load(3);
                            element.tabChange('tab-MoveStockBill', '2');
                            table.render({
                                elem: '#wl-table'
                                , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
                                , toolbar: '#toolbarDemo'
                                , totalRow: true
                                , defaultToolbar: []
                                , where: { HBillID: sInterID, HBillType: '1207', sWhere: '' }
                                , cols: [[
                                    { type: 'radio' }
                                    , { field: 'HQty', title: '数量', width: 150, totalRow: true }
                                    , { field: 'HQtyMust', title: '应收数量', width: 150, totalRow: true}
                                    , { 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 }
                                    , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                                ]]
                                // , data: [linterid]
                                // , page: true
                                , height: 500
                                , done: function () {
                                    layer.closeAll("loading");
                                }
                            });
                            $("#HSourceBillNo").attr("disabled", "true");
                        }
                        else {
                            playSound();
                            layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        }
                        layer.closeAll("loading");
                    }
                });
            }
        });
        //清空表头
        //function f_ClearTitle() {
        //    $("#HBarCode").val("");
        //    $("#HSpName").val("");
        //    $("#HSpID").val("0");
        //    $("#HQty").val("0");
        //    $("#HSourceBillNo").val("");
        //    $("#HWHNAME").val("");
        //    $("#HWHID").val("0");
        //    $("#HSCWHNAME").val("");
        //    $("#HSCWHID").val("0");
        //    $("#HSupName").val("");
        //    $("#HSupID").val("0");
        //    $("#HKeeper").val("");
        //    $("#HKeeperID").val("0");
        //    $("#HSecManager").val("0");
        //    $("#HSecManagerID").val("");
        //    $("#HDeptName").val("");
        //    $("#HDeptID").val("0");
        //    $("#HBillNo").val("");
        //    $("#HInterID").val("0");
        //}
        //以上为layui模块
        function GetHWHValue(obj)  //返回调入仓库
        {
            $("#HWHNAME").val(obj[0].HName);
            //sessionStorage["HWHID"] = obj[0].HItemID;
            $("#HWHID").val(obj[0].HItemID);
        }
        function GetHOrgNameValue(obj)  //返回调入组织
        {
            $("#HStockInOrgName").val(obj[0].HName);
@@ -1261,10 +1315,11 @@
            $("#HStockOutOrgID").val(obj[0].HItemID);
        }
        function GetHSpValue(obj) {  //返回调入仓位
            $("#HStockPlaceName").val(obj[0].HName);
            $("#HStockPlaceID").val(obj[0].HItemID);
            $("#HWHNAME").val(obj[0].HWhName);
            $("#HWHID").val(obj[0].HWHID);
        }
        function GetHSCWHNAMEValue(obj)  //返回调出仓库
        {
@@ -1274,6 +1329,8 @@
        function GetHOutStockPlaceIDValue(obj) {  //返回调出仓位
            $("#HOutStockPlaceName").val(obj[0].HName);
            $("#HOutStockPlaceID").val(obj[0].HItemID);
            $("#HSCWHNAME").val(obj[0].HWhName);
            $("#HSCWHID").val(obj[0].HWHID);
        }
        function GetHSupValue(obj) {  //返回供应商
            $("#HSupName").val(obj[0].HName);
@@ -1291,8 +1348,6 @@
            $("#HDeptName").val(obj[0].HName);
            $("#HDeptID").val(obj[0].HItemID);
        }
        //返回班组
        function GetProductionTeamValue(obj) {   //返回班组
            if (obj.length == 0) {
                layer.msg("请先选择班组", { index: 0 });
@@ -1302,24 +1357,7 @@
                layer.closeAll();
            }
        }
        //function Get_CheckWhAndSP(sInterID, sHBillType, sBarCode, sHWHID, sHSPID) {   //返回部门
        //    $.ajax({
        //        type: "GET",
        //        data: { "sHInterID": sInterID, "sHBillType": sHBillType, "sBarCode": sBarCode, "sHWHID": sHWHID, "sHSPID": sHSPID },
        //        success: function (result) {
        //            if(result.count==1)
        //            {
        //               // layer.msg(result.Message, { icon: 1 });
        //                return true;
        //            }
        //            else
        //            {
        //                layer.msg(result.Message, { icon: 5 });
        //                return false;
        //            }
        //        }
        //    })
        //}
        function AllowLoadData(sSubStr, bnt) {  //非空验证
            //if ($("#HSourceBillNo").val() == '') {
            //    layer.msg("请先扫源单!", { icon: 5 });
@@ -1383,6 +1421,7 @@
                return true;
            }
        }
    </script>
</body>