duhe
2024-05-28 262cee2e43059f55330b5efda849fcd1d445efd2
WebTM/views/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/InventoryAnalysis.html
@@ -9,6 +9,7 @@
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/soulTable.slim.js"></script>
    <style type="text/css">
        input.layui-input.layui-unselect {
            padding-right: 0;
@@ -45,6 +46,9 @@
                                                </button>
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch1" id="btnReSearch1">
                                                    é‡ç½®
                                                </button>
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnDel" id="btnDel">
                                                    åˆ é™¤
                                                </button>
                                            </div>
                                        </div>
@@ -169,7 +173,7 @@
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index', //主入口模块
        }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate'], function () {
        }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate','soulTable'], function () {
            // #region å…¨å±€å˜é‡
            var $ = layui.$
                , admin = layui.admin
@@ -188,6 +192,7 @@
                , laypage = layui.laypage
                , laydate = layui.laydate
                , util = layui.util
                , soulTable = layui.soulTable
            //查询条件
            var sWhere = " HRealPotType=HBookPotType and HRealPot=HBookPot";
            var option1 = [];
@@ -198,16 +203,17 @@
            var option6 = [];
            var option7 = [];
            var col = [
                { type: 'checkbox', fixed: 'left' }
                , { field: 'HItemID', title: 'HItemID', width: 200,hide: true}
                , { field: 'HBarCode', title: '器具条码', width: 200 }
                , { field: 'HMouldNo', title: '器具编号', width: 200 }
                , { field: 'HStockCheck', title: '盘点方案', width: 200 }
                , { field: 'HRealPotType', title: '实际位置类型', width: 200 }
                , { field: 'HRealPot', title: '实际位置', width: 200 }
                , { field: 'HBookPotType', title: '账面位置类型', width: 200 }
                , { field: 'HBookPot', title: '账面位置', width: 200 }
                , { field: 'HOWNERName', title: '盘点组织', width: 200 }
                { type: 'checkbox', fixed: 'left', totalRowText: '合计行' }
                , { field: 'HItemID', title: 'HItemID', width: 200, hide: true, sort: true}
                , { field: 'HBarCode', title: '器具条码', width: 200, sort: true}
                , { field: 'HMouldNo', title: '器具编号', width: 200, sort: true}
                , { field: 'HStockCheck', title: '盘点方案', width: 200, sort: true}
                , { field: 'HRealPotType', title: '实际位置类型', width: 200, sort: true}
                , { field: 'HRealPot', title: '实际位置', width: 200, sort: true}
                , { field: 'HBookPotType', title: '账面位置类型', width: 200, sort: true}
                , { field: 'HBookPot', title: '账面位置', width: 200, sort: true}
                , { field: 'HOWNERName', title: '盘点组织', width: 200, sort: true}
                , { field: 'HMakeDate', title: '盘点日期', width: 200, templet: "<div>{{d.HMakeDate ==null ?'':layui.util.toDateString(d.HMakeDate, 'yyyy-MM-dd')}}</div>", sort: true }
            ];
            //#endregion
@@ -216,22 +222,7 @@
            set_ClearBill();
            //#endregion
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
            //#region å¤´å·¥å…·æ äº‹ä»¶ æ­£å¸¸
            table.on('toolbar(mainTable1)', function (obj) {
                switch (obj.event) {
                    //审核
                    case 'btn-Check1': set_CheckBill1();
                        break;
                    //刷新
                    case 'btn-Refresh1': set_ClearQuery();;
                        break;
                    //退出按钮
                    case 'btn-Exit1': Pub_Close1(2);
                        break;
                };
            });
            //#endregion
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
            //#region å¤´å·¥å…·æ äº‹ä»¶ è°ƒæ‹¨
            table.on('toolbar(mainTable2)', function (obj) {
                switch (obj.event) {
@@ -326,22 +317,71 @@
            //查询按钮
            form.on('submit(btnSearch1)', function (data) {
                var HItemID = $("#HItemID").val();//盘点
                //进入页面显示的缓存列表
                $.ajax({
                    url: GetWEBURL() + 'Gy_StockCheckItemBill/Get_InventoryAnalysisList',
                    type: "GET",
                    data: { "sWhere": sWhere, "sID": HItemID },
                    success: function (data1) {
                        if (data1.count == 1) {
                            option1.data = data1.list[0];
                            table1.render(option1);
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                if (HItemID) {
                    //盘点分析列表判断当前选择的盘点方案是否生成过单据
                    $.ajax({
                        url: GetWEBURL() + 'Gy_StockCheckItemBill/StockItemSubIsExistence',
                        type: "GET",
                        data: { "sID": HItemID },
                        success: function (data1) {
                            if (data1.count == 0) {
                                layer.confirm('暂未生成过对应盘点方案数据,是否生成?', {
                                    icon: 3,
                                    title: "提示",
                                    btn: ['确定', '取消'],
                                    submit: function (index) {
                                        //进入页面显示的缓存列表
                                        $.ajax({
                                            url: GetWEBURL() + 'Gy_StockCheckItemBill/Get_InventoryAnalysisList',
                                            type: "GET",
                                            data: { "sWhere": sWhere, "sID": HItemID },
                                            success: function (data1) {
                                                if (data1.count == 1) {
                                                    option1.data = data1.list[0];
                                                    table1.render(option1);
                                                } else {
                                                    layer.alert(result.code + result.Message, { icon: 5 });
                                                }
                                            },
                                            error: function () {
                                                layer.alert("接口失效!", { icon: 5 });
                                            }
                                        });
                                    },
                                    cancel: function (index, layero) {
                                        layer.close(index);
                                        location.reload();
                                    }
                                });
                            }
                            else {
                                $.ajax({
                                    url: GetWEBURL() + 'Gy_StockCheckItemBill/Get_InventoryAnalysisList',
                                    type: "GET",
                                    data: { "sWhere": sWhere, "sID": HItemID },
                                    success: function (data1) {
                                        if (data1.count == 1) {
                                            option1.data = data1.list[0];
                                            table1.render(option1);
                                        } else {
                                            layer.alert(result.code + result.Message, { icon: 5 });
                                        }
                                    }, error: function () {
                                        layer.alert("接口失效!", { icon: 5 });
                                    }
                                });
                            }
                        }, error: function () {
                            layer.alert("接口失效!", { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口失效!", { icon: 5 });
                    }
                });
                    });
                }
                else {
                    layer.msg("请选择盘点方案");
                    return;
                }
            });
            // é‡ç½®æŒ‰é’®
@@ -358,12 +398,45 @@
                            option1.data = data1.list[0];
                            table1.render(option1);
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口失效!", { icon: 5 });
                    }
                });
            });
            //删除按钮
            form.on('submit(btnDel)', function (data) {
                var HItemID = $("#HItemID").val();//盘点
                if (HItemID) {
                    layer.confirm('是否删除其他无用的库存?', {
                        icon: 3,
                        title: "提示",
                        btn: ['确定', '取消'],
                        btn1: function (index) {
                            $.ajax({
                                url: GetWEBURL() + 'Gy_StockCheckItemBill/StockItemSubDel',
                                type: "GET",
                                anysc: false,
                                data: { "sID": HItemID },
                                success: function (data1) {
                                    if (data1.count == 1) {
                                        layer.msg(data1.Message, { icon: 1 });
                                    } else {
                                        layer.alert(data1.code + data1.Message, { icon: 5 });
                                    }
                                }, error: function () {
                                    layer.alert("接口失效!", { icon: 5 });
                                }
                            })
                        }
                    })
                }
                else {
                    layer.msg("请选择盘点方案");
                    return;
                }
            });
            //盘点方案弹窗
@@ -460,9 +533,8 @@
                set_InitGrid6();
                //初始化表格(退库)
                set_InitGrid7();
                //查询
                zc_Display();
                //初始查正常页签
                //zc_Display();
            }
            //初始化表格(正常)
@@ -473,10 +545,14 @@
                    , toolbar: '#toolbarDemo1'
                    , height: '550'
                    , page: true
                    , totalRow: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
                    , cols: [col]
                    , done: function (res, curr, count) {
                        soulTable.render(this);
                    }
                };
                option1.data = [];
                table1.render(option1);
@@ -491,6 +567,7 @@
                    , toolbar: '#toolbarDemo2'
                    , height: '550'
                    , page: true
                    , totalRow: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
@@ -509,6 +586,7 @@
                    , toolbar: '#toolbarDemo3'
                    , height: '550'
                    , page: true
                    , totalRow: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
@@ -527,6 +605,7 @@
                    , toolbar: '#toolbarDemo4'
                    , height: '550'
                    , page: true
                    , totalRow: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
@@ -545,6 +624,7 @@
                    , toolbar: '#toolbarDemo5'
                    , height: '550'
                    , page: true
                    , totalRow: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
@@ -563,6 +643,7 @@
                    , toolbar: '#toolbarDemo6'
                    , height: '550'
                    , page: true
                    , totalRow: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
@@ -581,6 +662,7 @@
                    , toolbar: '#toolbarDemo7'
                    , height: '550'
                    , page: true
                    , totalRow: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
@@ -615,7 +697,7 @@
            }
            //调拨查询
            function db_Display() {
                var sWhere = " HRealPotType=HBookPotType and HRealPotType='仓库' and HRealPot!=HBookPot";
                var sWhere = " HRealPotType=HBookPotType and HRealPotType=''仓库'' and HRealPot!=HBookPot";
                var HItemID = $("#HItemID").val();//盘点
                //进入页面显示的缓存列表
                $.ajax({
@@ -636,8 +718,9 @@
            }
            //出库查询
            function ck_Display() {
                var sWhere = " HBookPotType='仓库' and isnull(HBookPot,'')!='' and (HRealPotType='供应商' or HRealPotType='客户') and isnull(HRealPot,'')!=''";
                var sWhere = " HBookPotType=''仓库'' and isnull(HBookPot,'''')!='''' and (HRealPotType=''供应商'' or HRealPotType=''客户'') and isnull(HRealPot,'''')!=''''";
                var HItemID = $("#HItemID").val();//单据类型
                //进入页面显示的缓存列表
                $.ajax({
                    url: GetWEBURL() + 'Gy_StockCheckItemBill/Get_InventoryAnalysisList',
@@ -657,8 +740,9 @@
            }
            //入库查询
            function rk_Display() {
                var sWhere = " (HRealPotType='供应商' or HRealPotType='客户') and (HBookPotType='供应商' or HBookPotType='客户') and HRealPot!=HBookPot";
                var sWhere = " (HRealPotType=''供应商'' or HRealPotType=''客户'') and (HBookPotType=''供应商'' or HBookPotType=''客户'') and HRealPot!=HBookPot";
                var HItemID = $("#HItemID").val();//单据类型
                //进入页面显示的缓存列表
                $.ajax({
                    url: GetWEBURL() + 'Gy_StockCheckItemBill/Get_InventoryAnalysisList',
@@ -678,8 +762,9 @@
            }
            //盘盈查询
            function py_Display() {
                var sWhere = "isnull(HBookPot,'')='' and isnull(HRealPot,'')!=''";
                var sWhere = "py";
                var HItemID = $("#HItemID").val();//单据类型
                //进入页面显示的缓存列表
                $.ajax({
                    url: GetWEBURL() + 'Gy_StockCheckItemBill/Get_InventoryAnalysisList',
@@ -699,8 +784,9 @@
            }
            //盘亏查询
            function pk_Display() {
                var sWhere = "isnull(HBookPot,'')!='' and isnull(HRealPot,'')=''";
                var sWhere = "pk";
                var HItemID = $("#HItemID").val();//单据类型
                //进入页面显示的缓存列表
                $.ajax({
                    url: GetWEBURL() + 'Gy_StockCheckItemBill/Get_InventoryAnalysisList',
@@ -720,8 +806,9 @@
            }
            //退库查询
            function tk_Display() {
                var sWhere = " HRealPotType='仓库' and isnull(HRealPot,'')!='' and  (HBookPotType='供应商' or HBookPotType='客户')";
                var sWhere = " HRealPotType=''仓库'' and isnull(HRealPot,'''')!='''' and  (HBookPotType=''供应商'' or HBookPotType=''客户'')";
                var HItemID = $("#HItemID").val();//单据类型
                //进入页面显示的缓存列表
                $.ajax({
                    url: GetWEBURL() + 'Gy_StockCheckItemBill/Get_InventoryAnalysisList',
@@ -741,14 +828,13 @@
            }
            //#endregion
            //#region å®¡æ ¸
            //审核 è°ƒæ‹¨
            function set_CheckBill2() {
                var checkStatus = table.checkStatus('mainTable2')
                    , data = checkStatus.data;
                if (checkStatus.data.length >= 1) {
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"];
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"] + ";" + $("#HName").val();
                    $('#btn-Check2').addClass("layui-btn-disabled").attr("disabled", true);
                    $.ajax({
                        type: "POST",
@@ -783,7 +869,7 @@
                var checkStatus = table.checkStatus('mainTable3')
                    , data = checkStatus.data;
                if (checkStatus.data.length >= 1) {
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"];
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"] + ";" + $("#HName").val();
                    $('#btn-Check3').addClass("layui-btn-disabled").attr("disabled", true);
                    $.ajax({
                        type: "POST",
@@ -817,7 +903,7 @@
                var checkStatus = table.checkStatus('mainTable4')
                    , data = checkStatus.data;
                if (checkStatus.data.length >= 1) {
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"];
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"] + ";" + $("#HName").val();
                    $('#btn-Check4').addClass("layui-btn-disabled").attr("disabled", true);
                    $.ajax({
                        type: "POST",
@@ -851,7 +937,7 @@
                var checkStatus = table.checkStatus('mainTable5')
                    , data = checkStatus.data;
                if (checkStatus.data.length >= 1) {
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"];
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"] + ";" + $("#HName").val();
                    $('#btn-Check5').addClass("layui-btn-disabled").attr("disabled", true);
                     $.ajax({
                         type: "POST",
@@ -885,7 +971,7 @@
                var checkStatus = table.checkStatus('mainTable6')
                    , data = checkStatus.data;
                if (checkStatus.data.length >= 1) {
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"];
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"] + ";" + $("#HName").val();
                    $('#btn-Check6').addClass("layui-btn-disabled").attr("disabled", true);
                    $.ajax({
                        type: "POST",
@@ -919,7 +1005,7 @@
                var checkStatus = table.checkStatus('mainTable7')
                    , data = checkStatus.data;
                if (checkStatus.data.length >= 1) {
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"];
                    var sSubStr = JSON.stringify(data) + ";" + sessionStorage["HUserName"] + ";" + sessionStorage["OrganizationID"] + ";" + $("#HName").val();
                    $('#btn-Check7').addClass("layui-btn-disabled").attr("disabled", true);
                    $.ajax({
                        type: "POST",