zgq
2021-03-29 9451b3f86064ca3c94e1eca0c7e2b4cdba648842
WebTM/views/ÁìÁÏ·¢»õ/ÏúÊÛ³ö¿â/Kf_SellOutBill_Fast.html
@@ -35,9 +35,11 @@
                            <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;">日志</li>
                            <li lay-id="5" style="padding:1px;">源单找货</li>
                            <li lay-id="6" style="padding:1px;">日志</li>
                        </ul>
                        <div class="layui-tab-content">
                            <!--源单信息-->
                            <div class="layui-tab-item layui-show">
                                <div class="layui-form-item">
                                    <div class="layui-row">
@@ -63,6 +65,7 @@
                                    </div>
                                </div>
                            </div>
                            <!--单据信息-->
                            <div class="layui-tab-item">
                                <div class="layui-form-item" style="padding:0px;margin:0px">
                                    <div class="layui-row">
@@ -88,7 +91,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" lay-submit="" class="layui-btn" lay-filter="HSpID-BT">...</button>
                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HSpID-BT" style="display:none">...</button>
                                        </div>
                                    </div>
                                </div>
@@ -174,17 +177,18 @@
                                    </div>
                                </div>
                            </div>
                            <!--物料清单-->
                            <div class="layui-tab-item">
                                <!--<div class="layui-form-item" style="padding:0px;margin:0px">
                            <div class="layui-row">
                                <div class="layui-col-xs4">
                                    <label class="layui-form-label" style="width:40px;padding-left:0px;">条码</label>
                                </div>
                                <div class="layui-col-xs8">
                                    <input type="text" name="HBarCode" id="HBarCode" lay-verify="HBarCode" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>-->
            <div class="layui-row">
                <div class="layui-col-xs4">
                    <label class="layui-form-label" style="width:40px;padding-left:0px;">条码</label>
                </div>
                <div class="layui-col-xs8">
                    <input type="text" name="HBarCode" id="HBarCode" lay-verify="HBarCode" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>-->
                                <div class="layui-form-item" style="padding:0px;margin:0px">
                                    <div class="layui-row">
                                        <div class="layui-col-xs3">
@@ -197,9 +201,15 @@
                                </div>
                                <table class="layui-hide" id="wl-table" lay-filter="wl-table"></table>
                            </div>
                            <!--明细清单-->
                            <div class="layui-tab-item">
                                <table class="layui-hide" id="mx-table" lay-filter="mx-table"></table>
                            </div>
                            <!--源单找货-->
                            <div class="layui-tab-item">
                                <table class="layui-hide" id="zh-table" lay-filter="zh-table"></table>
                            </div>
                            <!--日志-->
                            <div class="layui-tab-item">
                                <table class="layui-hide" id="fj-table-qd" lay-filter="fj-table-qd"></table>
                            </div>
@@ -248,6 +258,29 @@
            , form = layui.form
            , element = layui.element;
            //源单找货列表
            var ZHOption = {
                elem: '#zh-table'
                //, toolbar: '#toolbarDemo'
                , height: 'full-50'
                , page: true
                , cellMinWidth: 90
                , cols: [[
                    { field: '在库状态', title: '在库状态',width:180 }
                    , { field: '物料名称', title: '物料名称' }
                    , { field: '批次', title: '批次' }
                    , { field: '数量', title: '数量' }
                    , { field: '物料代码', title: '物料代码' }
                    , { field: '规格型号', title: '规格型号' }
                ]]
                , text: {
                    none: '暂无相关数据,请先扫描源单号!'
                }
            };
            //初始加载表格
            ZHOption.data = [];
            table.render(ZHOption);
            //表头初始化赋值(根据登录用户获取 é»˜è®¤ä»“库、部门、验收、保管、金蝶用户) new
            $("#HWHID").val(sessionStorage["HWHID"]);
@@ -267,9 +300,14 @@
            $("#HMakerID").hide();
            $("#HBillerID").val(sessionStorage["HBillerID"]);
            $("#HBillerID").hide();
            var HSourceFlag = sessionStorage["SourceFlag"];
            //默认带入的仓库,如果启用仓位则仓位有效,如果没有启用则仓位灰度 new
            //判断是否登录 æœªç™»å½•则跳到登录页
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { window.location.href = "../../user/login.html"; });
            }
            //获取参数
@@ -289,7 +327,7 @@
        
            
            function  RoadBillMain(linterid)//加载表头
            function  RoadBillMain(linterid)//加载表头-----不会走
            {
                $.ajax({
                    url: GetWEBURL() + "/Web/GetPonderationBill",
@@ -312,7 +350,7 @@
                })
            }
            function RoadSup()//根据源单类型及源单号 åŠ è½½å®¢æˆ·
            function RoadSup()//根据源单类型及源单号 åŠ è½½å®¢æˆ·-----不会走
            {
                //var sInterID = $("#HInterID").val()
                var HSourceBillNo = $('#HSourceBillNo').val()
@@ -334,8 +372,8 @@
                                $("#HSupID").val(result.data[0].HSupID);
                                $("#HSupName").val(result.data[0].HSupName);
                                $("#HDeptID").val(result.data[0].HDeptID);
                                $("#HDeptName").val(result.data[0].HDeptName);
                                sessionStorage["SourceFlag"] = true;
                                //$("#HDeptName").val(result.data[0].HDeptName);
                                //sessionStorage["SourceFlag"] = true;
                                element.tabChange('tab-SellOutBill', '2');
                                layer.load(3);
                            }
@@ -348,11 +386,11 @@
                }
            }
            function RoadBillSub(linterid)//加载表体
            function RoadBillSub(linterid)//加载表体-----不会走
            {
                table.render({
                    elem: '#wl-table'
                    , url: GetWEBURL1() + '/SellOut/DisBillEntryList_Webs_Json'
                    , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
                    , cellMinWidth: 80
                    , toolbar: '#toolbarDemo'
                    , where: { HBillID: linterid, HBillType: '1205', sWhere: '' }
@@ -370,7 +408,7 @@
                    , { field: 'HAuxPropID', title: '辅助属性', width: 100 }
                    , { field: 'HMTONo', title: '计划跟踪号', width: 100 }
                    ]]
                    , height: 500
                    //, height: 500
                })
            }
             
@@ -400,7 +438,7 @@
                    }
                }); 
            }
            else {//如果修改则走下面 new
            else {//如果修改则走下面 new-----不会走
                RoadBillMain(linterid);
                RoadBillSub(linterid);
            }
@@ -436,6 +474,7 @@
                    }
                })
            });
            form.on('submit(HSupID-BT)', function () {//选择客户
                layer.open({
                    type: 2
@@ -499,7 +538,7 @@
            });
            form.on('submit(Cancel)', function () {
                sessionStorage["SourceFlag"] = false;
                //sessionStorage["SourceFlag"] = false;
                parent.location.href = "../../../views/index.html"
                //window.close();//关闭当前页
            })
@@ -549,7 +588,7 @@
                           if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†
                               table.render({
                                   elem: '#wl-table' 
                                   , url: GetWEBURL1() + '/SellOut/DisBillEntryList_Webs_Json'
                                   , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
                                   , cellMinWidth: 80
                                   , toolbar: '#toolbarDemo'
                                   , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
@@ -567,7 +606,7 @@
                                    , { field: 'HAuxPropID', title: '辅助属性', width: 100 }
                                    , { field: 'HMTONo', title: '计划跟踪号', width: 100 }
                                   ]]
                                    , height: 500
                                    //, height: 500
                               })
                           }
                           else {
@@ -588,7 +627,6 @@
                var sSourceType = $("#HBillType").val();
                if (AllowLoadData(sSubStr) != false)//非空验证
                {
                    layer.load(3);
                    var flage = true;
                    for (var i = 0; i < sSubStr.length; i++) {
                        if (sSubStr[i].HQty == 0) {
@@ -599,42 +637,52 @@
                        layer.confirm('实际扫描卷数小于找货单数量!是否继续提交?', {
                            btn: ['ç»§ç»­', '取消'], skin: 'layui-layer-lan', title: "温馨提示"
                        }, function () {
                            $.ajax(
                            {
                                type: "POST",
                                // url: "http://61.130.49.162:9090/WMSAPI///SellOut/set_SaveSellOutBill_Json", //方法所在页面和方法名
                                url: GetWEBURL() + "/SellOut/set_SaveSellOutBill_Json",
                                async: true,
                                data: { "oMain": sMainStr },
                                dataType: "json",
                                success: function (data) {
                                    if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†
                                        layer.confirm("生成销售出库单" + data.Message + $("#HBillNo").val(), {
                                            icon: 1, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['新增'],
                                            btn2: function () {
                                                //parent.layui.admin.events.closeThisTabs();关闭页签
                                                //window.close();//关闭页面,浏览器有效,PDA无效
                                                parent.location.href = "../../../views/index.html"
                                            }//关闭
                                        }, function () { window.location.reload(); });//新增
                                    }
                                    else {
                                        layer.msg(data.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: "温馨提示" });
                                }
                            });
                            Saver(sMainStr);
                        }, function () {
                            layer.closeAll("loading");
                        });
                    } else {
                        Saver(sMainStr);
                    }
                    
                    return false;
                }
            });
            //提交方法调用的ajax
            function Saver(sMainStr) {
                layer.load(1);
                $.ajax(
                {
                    type: "POST",
                    // url: "http://61.130.49.162:9090/WMSAPI///SellOut/set_SaveSellOutBill_Json", //方法所在页面和方法名
                    url: GetWEBURL() + "/SellOut/set_SaveSellOutBill_Json",
                    async: true,
                    data: { "oMain": sMainStr },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†
                            layer.confirm(data.Message + $("#HBillNo").val(), {
                                icon: 1, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['新增'],
                                btn2: function () {
                                    //parent.layui.admin.events.closeThisTabs();关闭页签
                                    //window.close();//关闭页面,浏览器有效,PDA无效
                                    parent.location.href = "../../../views/index.html";
                                }//关闭
                            }, function () {
                                //sessionStorage["SourceFlag"] = false;
                                window.location.reload();
                            });//新增
                        }
                        else {
                            layer.msg(data.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: "温馨提示" });
                    }
                });
            }
            //监听提交
            form.verify({
                numberOrEmpty: function (value, item) {
@@ -656,7 +704,7 @@
                var sHWHID = $("#HWHID").val();//仓库ID
                var sHSPID = $("#HStockPlaceID").val();//仓位ID
                var sQty = $("#HQty").val()//数量
                var SourceFlag = sessionStorage["SourceFlag"];
                //var SourceFlag = sessionStorage["SourceFlag"];
                var sSourceBillNo = $("#HSourceBillNo").val();//源单号
                var sHBillType = $("#HBillType").val()  //源单类型-发货通知单:1402,销售订单1401
                
@@ -674,7 +722,7 @@
                    $.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": SourceFlag, "sSourceBillNo": sSourceBillNo, "sSourceType": sHBillType, "HOWNERID": 0 },
                        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": 0 },
                        success: function (result) {
                            if (result.count == 1) {
                                if (result.data.HBarType == '仓库条码') {
@@ -701,10 +749,10 @@
                                else if (result.data.HBarType == '源单条码') {
                                    $("#HSupName").val(result.data.HSupName);
                                    $("#HSupID").val(result.data.HSupID);
                                    $("#HDeptName").val(result.data.HDeptName);
                                    //$("#HDeptName").val(result.data.HDeptName);
                                    $("#HDeptID").val(result.data.HDeptID);
                                    $("#HSourceBillNo").val(result.data.HSourceBillNo);
                                    sessionStorage["SourceFlag"] = true;
                                    HSourceFlag = true;
                                    //获取源单类型、源单单号
                                    if (result.data.HSourceBillType == "1402") {
                                        $("#HBillType").val("1402");
@@ -720,16 +768,16 @@
                                    element.tabChange('tab-Kf_SellOutBill', '3');
                                }
                                else {
                                    if (sessionStorage["SourceFlag"] == "true") {
                                    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);
                                        //$("#HDeptName").val(result.data.HDeptName);
                                        $("#HDeptID").val(result.data.HDeptID);
                                        $("#HSourceBillNo").val(result.data.HSourceBillNo);
                                        sessionStorage["SourceFlag"] = true;
                                        HSourceFlag = true;
                                        //获取源单类型、源单单号
                                        if (result.data.HSourceBillType == "1402") {
                                            $("#HBillType").val("1402");
@@ -753,7 +801,7 @@
                                table.render({
                                    elem: '#wl-table'
                                    // , url: 'http://61.130.49.162:9090/WMSAPI///OtherInStockBill/DisBillEntryList_Webs_Json'
                              , url: GetWEBURL1() + '/SellOut/DisBillEntryList_Webs_Json'
                              , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
                              , toolbar: '#toolbarDemo'
                              , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                              , cols: [[
@@ -770,7 +818,7 @@
                              ]]
                                    // , data: [linterid]
                                    // , page: true
                              , height: 500
                              //, height: 500
                              , done: function () {
                                  layer.closeAll("loading");
                              }
@@ -782,6 +830,9 @@
                                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: "温馨提示" });
                        }
                    });
                }
@@ -792,7 +843,7 @@
                if (event.keyCode == 13) {
                    //判断文本框是否有数据    new
                    $.ajax({
                        url: GetWEBURL() + "/Web/GetSpName_Json",
                        url: GetWEBURL() + "/LookingFor/getSpName_Json",
                        type: "GET",
                        data: { "HBarCode": HBarCode },
                        success: function (result) {
@@ -854,7 +905,7 @@
            //                    table.render({
            //                        elem: '#wl-table'
            //                        //, url: 'http://61.130.49.162:9090/WMSAPI///SellOut/DisBillEntryList_Webs_Json'
            //                        , url: GetWEBURL1() + '/SellOut/DisBillEntryList_Webs_Json'
            //                        , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
            //                  , toolbar: '#toolbarDemo'
            //                  , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
            //                  , cellMinWidth: 90
@@ -894,8 +945,10 @@
                var sBillNo = $("#HBillNo").val()
                var HSourceBillType = $("#HBillType").val()
                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;
                    }
@@ -909,13 +962,11 @@
                                $("#HSupName").val(result.data[0].HSupName);
                                //$("#HDeptID").val(result.data[0].HDeptID);
                                //$("#HDeptName").val(result.data[0].HDeptName);
                                sessionStorage["SourceFlag"] = true;
                                element.tabChange('tab-SellOutBill', '2');
                                layer.load(3);
                                HSourceFlag = true;
                                element.tabChange('tab-SellOutBill', '3');
                                table.render({
                                    elem: '#wl-table'
                                    , url: GetWEBURL1() + '/SellOut/DisBillEntryList_Webs_Json'
                                    , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
                                  , toolbar: '#toolbarDemo'
                                  , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                                  , cols: [[
@@ -932,16 +983,18 @@
                                  ]]
                                    // , data: [linterid]
                                    // , page: true
                                  , height: 500
                                  //, height: 500
                                  , done: function () {
                                      layer.closeAll("loading");
                                      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.closeAll("loading");
                            layer.close(index);
                        }
                    });
                }
@@ -960,6 +1013,36 @@
             , done: function () {
             }
            });
            //扫源单查货
            $('#HSourceBillNo').on('keydown', function (event) {
                var HSourceBillNo = $('#HSourceBillNo').val();
                if (event.keyCode == 13) {
                    var index = layer.load(0);
                    $.ajax({
                        url: GetWEBURL() + "/LookingFor/GetSellOutFindSP",
                        type: "GET",
                        data: { "HbillNo": HSourceBillNo },
                        success: function (result) {
                            if (result.count == 1) {
                                ZHOption.data = result.data;
                                table.render(ZHOption);
                                layer.close(index);
                                element.tabChange('tab-SellOutBill', '5');
                            }
                            else {
                                layer.close(index);
                                layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            }
                        }, error: function () {
                            layer.close(index);
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
            });
        //以上为layui模块
        });
        function GetHWHValue(obj)  //返回仓库
        {