WebTM/views/²Ö´æ¹ÜÀí/²Ö¿âµ÷²¦/Cc_LookingForReturnBill.html
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>归还单</title>
<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">
@@ -50,34 +50,6 @@
                        <div class="layui-tab-content">
                            <!--表头信息-->
                            <div class="layui-tab-item">
                                <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:30px;padding-left:0px;">仓库</label>
                                        </div>
                                        <div class="layui-col-xs6">
                                            <input type="text" name="HWHName" id="HWHName" autocomplete="off" class="layui-input">
                                            <input type="hidden" name="HWHID" id="HWHID" value="0" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-col-xs3">
                                            <button type="button" id="HWHID-BT" lay-submit="" class="layui-btn" lay-filter="HWHID-BT">...</button>
                                        </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:30px;padding-left:0px;">仓位</label>
                                        </div>
                                        <div class="layui-col-xs6">
                                            <input type="text" name="HSPName" id="HSPName" autocomplete="off" class="layui-input">
                                            <input type="hidden" name="HSPID" id="HSPID" 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">...</button>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item" style="padding:0px;margin:0px">
                                    <div class="layui-row">
                                        <div class="layui-col-xs3">
@@ -151,6 +123,34 @@
                                        <input type="text" name="HBarCode" id="HBarCode" autocomplete="off" class="layui-input">
                                    </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:30px;padding-left:0px;">仓库</label>
                                        </div>
                                        <div class="layui-col-xs8">
                                            <input type="text" name="HWHName" id="HWHName" autocomplete="off" class="layui-input" readonly>
                                            <input type="hidden" name="HWHID" id="HWHID" value="0" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-col-xs1">
                                            <button type="button" id="HWHID-BT" lay-submit="" class="layui-btn" lay-filter="HWHID-BT">...</button>
                                        </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:30px;padding-left:0px;">仓位</label>
                                        </div>
                                        <div class="layui-col-xs8">
                                            <input type="text" name="HSPName" id="HSPName" autocomplete="off" class="layui-input">
                                            <input type="hidden" name="HSPID" id="HSPID" value="0" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-col-xs1">
                                            <button type="button" id="HSpID-BT" lay-submit="" class="layui-btn" lay-filter="HSpID-BT" style="display:none">...</button>
                                        </div>
                                    </div>
                                </div>
                                <table class="layui-hide" id="bzd-table2" lay-filter="bzd-table2"></table>
                            </div>
                        </div>
@@ -191,7 +191,7 @@
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { window.location.href = "user/login.html"; });
                }, function () { window.location.href = "../../user/login.html"; });
            }
            //初始基本信息赋值
@@ -229,15 +229,15 @@
                , cellMinWidth: 90
                , cols: [[
                    { type: 'numbers', title: '序号' }
                    , { field: 'HIsStatus', title: '是否扫码' }
                    , { field: 'HSourceInterID', title: '源单ID', hide: true }
                    , { field: 'HSourceBillNo', title: '源单号', width: 110 }
                    , { field: 'HIsStatus', title: '是否扫码', hide: true }
                    , { field: 'HMTONo', title: '批号', width: 180 }
                    , { field: 'HSPID', title: '仓位ID', hide: true }
                    , { field: 'HSPName', title: '仓位' }
                    , { field: 'HStatus', title: '在库状态', width: 165 }
                    , { field: 'HWhID', title: '仓库ID', hide: true }
                    , { field: 'HWhName', title: '仓库' }
                    , { field: 'HSPID', title: '仓位ID', hide: true }
                    , { field: 'HSPName', title: '仓位' }
                    , { field: 'HSourceInterID', title: '源单ID', hide: true }
                    , { field: 'HSourceBillNo', title: '源单号', width: 110 }
                    , { field: 'HGroupID', title: '班组ID', hide: true }
                    , { field: 'HGroup', title: '班组' }
                    , { field: 'HSourceID', title: '生产资源ID', hide: true }
@@ -249,11 +249,11 @@
                    , { field: 'HMaterModel', title: '规格型号' }
                    , { field: '即时库存', title: '即时库存' }
                    , { field: 'HBarCode', title: '条码编号', hide: true }
                    , { field: 'HInterID', title: '单据ID' }
                    , { field: 'HBillNo', title: '单据号' }
                    , { field: 'HMakerID', title: '制单人ID' }
                    , { field: 'HMaker', title: '制单人' }
                    , { field: 'HBillType', title: 'HBillType' }
                    , { field: 'HInterID', title: '单据ID', hide: true }
                    , { field: 'HBillNo', title: '单据号', hide: true }
                    , { field: 'HMakerID', title: '制单人ID', hide: true }
                    , { field: 'HMaker', title: '制单人', hide: true }
                    , { field: 'HBillType', title: 'HBillType', hide: true }
                ]]
                , text: {
                    none: '暂无相关数据,请先扫描源单号!' //默认:无数据。注:该属性为 layui 2.2.5 å¼€å§‹æ–°å¢ž
@@ -271,7 +271,7 @@
                    { type: 'numbers', title: '序号' }
                    //, { field: 'HIsStatus', title: '是否扫码' }
                    , { field: 'HSourceInterID', title: '源单ID', hide: true }
                    , { field: 'HSourceBillNo', title: '源单号', width: 110 }
                    , { field: 'HSourceBillNo', title: '源单号', hide: true }
                    , { field: 'HMTONo', title: '批号', width: 180 }
                    , { field: 'HStatus', title: '在库状态', width: 165 }
                    , { field: 'HWhID', title: '仓库ID', hide: true }
@@ -436,24 +436,37 @@
                        data: { "HBarCode": HBarCode },
                        success: function (result) {
                            if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                var data = result.data;
                                option2.data = data;
                                table.render(option2);
                                var sSubStr = table.cache['bzd-table2'];
                                sSubStr[0].HSourceID = $("#HSourceID").val();
                                sSubStr[0].HSource = $("#HSource").val();
                                sSubStr[0].HGroupID = $("#HGroupID").val();
                                sSubStr[0].HGroup = $("#HGroup").val();
                                sSubStr[0].HInterID = $("#HInterID").val();
                                sSubStr[0].HBillNo = $("#HBillNo").val();
                                sSubStr[0].HMakerID = $("#HMakerID").val();
                                sSubStr[0].HMaker = $("#HMaker").val();
                                option2.data = table.cache["bzd-table2"];
                                table.render(option2);
                                layer.close(index);
                                $('#HBarCode').val("");
                                layer.close(index);
                                layer.msg("扫码成功!", { icon: 1, time: 1000 });
                                var sSubStr = result.data;
                                for (var i = 0; i < sSubStr.length; i++) {
                                    if (sSubStr[i].HIsStatus == "是") {
                                        layer.close(index);
                                        $('#HBarCode').val("");
                                        layer.msg("该实物已扫码,请勿重复扫码", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                    } else if (sSubStr[i].HStatus == null || sSubStr[i].HStatus == "" || sSubStr[i].HStatus == "在库") {
                                        layer.close(index);
                                        layer.msg("该实物在" + sSubStr[i].HWhName + "-" + sSubStr[i].HSPName+",不允许扫码", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                    } else {
                                        var data = result.data;
                                        option2.data = data;
                                        table.render(option2);
                                        sSubStr = table.cache['bzd-table2'];
                                        sSubStr[i].HIsStatus = "是";
                                        sSubStr[i].HSourceID = $("#HSourceID").val();
                                        sSubStr[i].HSource = $("#HSource").val();
                                        sSubStr[i].HGroupID = $("#HGroupID").val();
                                        sSubStr[i].HGroup = $("#HGroup").val();
                                        sSubStr[i].HInterID = $("#HInterID").val();
                                        sSubStr[i].HBillNo = $("#HBillNo").val();
                                        sSubStr[i].HMakerID = $("#HMakerID").val();
                                        sSubStr[i].HMaker = $("#HMaker").val();
                                        option2.data = table.cache["bzd-table2"];
                                        table.render(option2);
                                        layer.close(index);
                                        $('#HBarCode').val("");
                                        layer.msg("扫码成功!", { icon: 1, time: 1000 });
                                    }
                                }
                            }
                            else {
                                option2.data = [];
@@ -544,26 +557,17 @@
            //提交
            form.on('submit(Saver)', function (data) {//提交
                //debugger;
                //var sMainStr = JSON.stringify(data.field);
                var tableData = table.cache['bzd-table2'];
                //for (var i = 0; i < tableData.length; i++) {
                //    if (tableData[i].HIsStatus == "是" ) {
                //    } else {
                //        //移除当前行
                //        tableData.splice(i, 1);
                //        i--;
                //        option.data = tableData;
                //        table.render(option);
                //    }
                //}
                var sSubStr = JSON.stringify(tableData);
                sSubStr = "{\"oSub\": " + sSubStr + "}";
                //sSubStr = JSON.stringify(sSubStr);
                //var json = "{\"oMain\":" + sMainStr + "},{\"oMain\":" + sSubStr + "}";
                if (AllowLoadData(sSubStr, 'Saver') != false)//非空验证
                {
                    //判断上架库位是否与条码中库位一致
                    var tableData = table.cache['bzd-table2'];
                    if ($("#HWHID").val() != tableData[0].HWhID && $("#HSPID").val() != tableData[0].HSPID) {
                        layer.msg("当前库位与实际不符!", { icon: 4, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        return;
                    }
                    var index = layer.load();
                    $.ajax(
                    {
@@ -607,20 +611,30 @@
                }
            });
            //扫上架仓位
            $('#HSPName').on('keydown', function (event) {      //扫仓位
                var HBarCode = $('#HSPName').val()
                var HBarCode = $('#HSPName').val();
                if (event.keyCode == 13) {
                    //判断文本框是否有数据    new
                    $.ajax({
                        url: GetWEBURL() + "/Web/GetSpName_Json",
                        url: GetWEBURL() + "/LookingFor/getSpName_Json",
                        type: "GET",
                        data: { "HBarCode": HBarCode },
                        success: function (result) {
                            if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                $("#HSPName").val(result.data[0].HName);
                                $("#HSPID").val(result.data[0].HItemID);
                                element.tabChange('tab-POStockInBill', '2');
                                var tableData = table.cache['bzd-table2'];
                                if (tableData.length == 0) {
                                    layer.msg("请先扫实物条码!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                    return;
                                }
                                if (result.data[0].HWHID != tableData[0].HWhID && result.data[0].HItemID != tableData[0].HSPID) {
                                    layer.msg("此库位与实际不符!", { icon: 4, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                } else {
                                    $("#HSPName").val(result.data[0].HName);
                                    $("#HSPID").val(result.data[0].HItemID);
                                    $("#HWHID").val(result.data[0].HWHID);
                                    $("#HWHName").val(result.data[0].HWhName);
                                }
                            }
                            else {
                                layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
@@ -724,9 +738,6 @@
                        }
                    }
                }
            }
            else {
                return true;
            }
        }
    </script>