yangle
2024-07-29 47617b6de6cf73760d0ffc4fdb21cd5c4f877430
WebTM/views/ÁìÁÏ·¢»õ/ÆäËû³ö¿â/Kf_OtherOutBill_FastList.html
@@ -38,6 +38,7 @@
                        <ul class="layui-tab-title" lay-filter="tab-all">
                            <li lay-id="1">缓存列表</li>
                            <li lay-id="2">已上传列表</li>
                            <li lay-id="3">已上传查询</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item  layui-show">
@@ -54,6 +55,28 @@
                                    </div>
                                </div>
                            </div>
                            <div class="layui-tab-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">单据号</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="HBillNo" id="HBillNo">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">源单号</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="HSourceBillNo" id="HSourceBillNo">
                                    </div>
                                </div>
                                <div class="layui-col-xs2">
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdQuery">查询</button>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-xs12">
                                        <table class="layui-hide" id="sy-table" lay-filter="sy-table"></table>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item" style="margin-bottom: 20px;">
                            <div class="layui-row">
@@ -65,6 +88,9 @@
                                </div>
                                <div class="layui-col-xs2">
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdRefresh">刷新</button>
                                </div>
                                <div class="layui-col-xs2">
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdRescind">撤销</button>
                                </div>
                                <div class="layui-col-xs2">
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdCancel">退出</button>
@@ -95,6 +121,8 @@
        , table = layui.table
        , form = layui.form
        , element = layui.element;
        var sBillType = '1206';
        var option = [];
        //清空界面  new
        //动态加载源单类型列表 new
@@ -104,140 +132,385 @@
        //读取单据列表
        //
        form.on('submit(Cancel)', function () {
            parent.location.href = "../../../views/index.html"
        //退出
        form.on('submit(cmdCancel)', function () {
            layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                parent.location.href = "../../../views/index_Mobile.html"
            });
            //window.close();//关闭当前页
        })
         //编辑
        form.on('submit(cmdModify)', function () {
            var checkStatus = table.checkStatus('dj-table')
                     , data = checkStatus.data;
            //ajaxLabelData = data;
            //layer.alert(rows);
            layer.open({
                type: 2
                , area: ['100%', '100%']
                , title: '其他出库单'
                , shade: 0.6 //遮罩透明度
                , maxmin: false //允许全屏最小化
                , anim: 0 //0-6的动画形式,-1不开启
                , content: ['../../领料发货/其他出库/Kf_OtherOutBill_Fast.html?linterid=' + data[0].HInterID, 'yes']
                , resize: false
                , cancel: function () {
                    $(".layui-btn").removeClass("layui-btn-disabled");
                , data = checkStatus.data;
            $.ajax({
                type: "GET",
                url: GetWEBURL() + "/WEBSController/TempList_Modify_Json",
                async: false,    //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
                data: { "HInterID": data[0].HInterID, "HBillNo": data[0].HBillNo, "HBillType": sBillType },
                success: function (result) {
                    if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                        layer.open({
                            type: 2
                            , area: ['100%', '100%']
                            , title: '其他出库单'
                            , shade: 0.6 //遮罩透明度
                            , maxmin: false //允许全屏最小化
                            , anim: 0 //0-6的动画形式,-1不开启
                            , content: ['../../领料发货/其他出库/Kf_OtherOutBill_Fast.html?OperationType=2&HInterID=' + data[0].HInterID, 'yes']
                            , resize: false
                            , cancel: function () {
                                $(".layui-btn").removeClass("layui-btn-disabled");
                            }
                        })
                    }
                    else {
                        layer.msg(result.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: "温馨提示" });
                }
            });
        });
        //刷新
        form.on('submit(cmdRefresh)', function () {
            var sBillType = '1206'
            table.render({
                elem: '#dj-table'
                , url: GetWEBURL() + '/Web/chanpinruk'
                , toolbar: '#toolbarDemo'
                , where: { HBillType: sBillType, sHMaker: sessionStorage["HUserName"], HOrgID: sessionStorage["OrganizationID"] }
                , cols: [[
                    { type: 'radio' }
                    , { field: 'HInterID', title: '单据内码', width: 120 }
                    , { field: 'HBillNo', title: '单据号', width: 150 }
                    , { field: 'HMaker', title: '制单人', width: 120 }
                    , { field: 'HMakeDate', title: '制单日期', width: 150 }
                    , { field: 'HQty', title: '数量', width: 100 }
                    , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                    , { field: 'HRedBlueFlag', title: '红蓝字', width: 120 }
                    , { field: 'HSourceBillType', title: '源单类型', width: 100 }
                ]]
                    , height: 500
                    , done: function () {
                        layer.closeAll("loading");
                    }
            });
            table.render({
                elem: '#yd-table'
                , url: GetWEBURL() + '/Web/DisBillUpdateLoad_Json'
                , toolbar: '#toolbarDemo'
                , where: { HBillType: sBillType, HMaker: sessionStorage["HUserName"], HOrgID: sessionStorage["OrganizationID"] }
                , page: true  // å¼€å¯åˆ†é¡µ
                , limits: [20, 40, 80, 100]
                , limit: 20
                , cols: [[
                    { type: 'radio' }
                    , { field: 'HInterID', title: '单据内码', width: 120 }
                    , { field: 'HBillNo', title: '单据号', width: 150 }
                    , { field: 'HMaker', title: '制单人', width: 120 }
                    , { field: 'HMakeDate', title: '制单日期', width: 150 }
                    , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                    , { field: 'HMaterName', title: '物料名称', width: 150 }
                    , { field: 'HMaterModel', title: '规格型号', width: 150 }
                    , { field: 'HQty', title: '数量', width: 100 }
                    , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                    , { field: 'HOrgID', title: '组织', width: 120 }
                ]]
                , height: 500
                , done: function () {
                    layer.closeAll("loading");
                }
            })
        });
        //撤销功能
        form.on('submit(cmdRescind)', function () {
            var checkStatus = table.checkStatus('yd-table')
            var checkStatus2 = table.checkStatus('sy-table');
            var checkStatus3 = table.checkStatus('dj-table');
            var data = "";
            if (checkStatus.data.length != 0) {
                data = checkStatus.data;
            } else if (checkStatus2.data.length != 0) {
                data = checkStatus2.data;
            } else if (checkStatus3.data.length != 0) {
                data = checkStatus3.data;
            } else {
                return layer.msg("请选择一条数据");
            }
            var sInterID = data[0].HInterID == 'undefined' ? data[0].单据内码 : data[0].HInterID;
            var sBillNo = data[0].HBillNo == 'undefined' ? data[0].单据号 : data[0].HBillNo;
            var sBillType = '1206'
            $.ajax(
                {
                    type: "Get",
                    url: GetWEBURL() + "/Web/Rescind_Json",
                    async: true,
                    data: { "sHInterID": sInterID, "sBillNo": sBillNo, "sBillType": sBillType },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () {
                                // å¾—到frame索引
                                var index = layer.getFrameIndex(window.name);
                                //关闭当前frame
                                layer.close(index);
                                //修改为功后刷新界面
                                window.location.reload();
                            });
                        }
                        else {
                            layer.msg(data.Message, { icon: 2 });
                        }
                    },
                    error: function (err) {
                        layer.msg('错误' + err, {
                            icon: 5,
                            time: 20000
                        }, function () {
                            //do something
                        });
                    }
                });
        });
        //删除
        form.on('submit(cmdDelete)', function () {
            var checkStatus = table.checkStatus('dj-table')
                , data = checkStatus.data;
            if (checkStatus.data.length === 1) {
                layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                    var sInterID = data[0].HInterID == 'undefined' ? data[0].单据内码 : data[0].HInterID;
                    $.ajax(
                        {
                            type: "Get",
                            url: GetWEBURL() + "/Web/Delete_Json",
                            async: true,
                            data: { "sHInterID": sInterID },
                            dataType: "json",
                            success: function (data) {
                                if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                    //layer.msg(data.Message, { icon: 1 });
                                    table.render({
                                        elem: '#dj-table'
                                        , url: GetWEBURL() + '/Web/DisBillEntryList_Mate_Webs_Json'
                                        , cellMinWidth: 80
                                        , toolbar: '#toolbarDemo'
                                        , where: { HBillType: '1206', sWhere: '' }
                                        , cols: [[
                                            { type: 'radio' }
                                            , { field: 'HInterID', title: '单据内码', width: 80 }
                                            , { field: 'HBillNo', title: '单据号', width: 80 }
                                            , { field: 'HMaker', title: '制单人', width: 100 }
                                            , { field: 'HMakeDate', title: '制单日期', width: 100 }
                                            , { field: 'HQty', title: '数量', width: 100 }
                                            , { field: 'HSourceBillNo', title: '源单单号', width: 100 }
                                            , { field: 'HRedBlueFlag', title: '红蓝字', width: 100 }
                                            , { field: 'HSourceBillType', title: '源单类型', width: 100 }
                                        ]]
                                        , height: 500
                                    })
                                }
                                else {
                                    layer.msg(data.Message, { icon: 2 });
                                }
                            },
                            error: function (err) {
                                layer.msg('错误' + err, {
                                    icon: 5,
                                    time: 20000
                                }, function () {
                                    //do something
                                });
                            }
                        });
                })
            }
            else {
                layer.msg('请选择一行数据删除!');
            }
        });
        //查询
        form.on('submit(cmdQuery)', function () {
            var HBillNo = $("#HBillNo").val();
            var HSourceBillNo = $("#HSourceBillNo").val();
            var index = layer.load();
            //进入页面显示的缓存列表
            table.render({
                elem: '#sy-table'
                , url: GetWEBURL() + '/ProductInBillList/list1'
                , toolbar: '#toolbarDemo'
                , defaultToolbar: []
                , where: { "BillType": sBillType, "HBillNo": HBillNo, "HSourceBillNo": HSourceBillNo }
                , cols: [[
                    { type: 'radio' }
                    , { field: 'HInterID', title: '单据内码', width: 120 }
                    , { field: 'HBillNo', title: '单据号', width: 150 }
                    , { field: 'HMaker', title: '制单人', width: 120 }
                    , { field: 'HMakeDate', title: '制单日期', width: 150 }
                    , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                    , { field: 'HMaterName', title: '物料名称', width: 150 }
                    , { field: 'HMaterModel', title: '规格型号', width: 150 }
                    , { field: 'HQty', title: '数量', width: 100 }
                    , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                    , { field: 'HOrgID', title: '组织', width: 120 }
                ]]
                , height: 500
                , done: function () {
                    layer.closeAll("loading");
                }
            })
        });
        form.on('submit(cmdRefresh)', function () {//编辑
            var sBillType = '1206'
            table.render({
                elem: '#dj-table'
                    , url: GetWEBURL() + '/Web/DisBillEntryList_Mate_Webs_Json'
                    ,toolbar: '#toolbarDemo'
                    , where: { HBillType: sBillType,sWhere:''}
                    , cols: [[
                          { type: 'radio' }
                        , { field: 'HInterID', title: '单据内码', width: 80 }
                        , { field: 'HBillNo', title: '单据号', width: 80 }
                        , { field: 'HMaker', title: '制单人', width: 100 }
                        , { field: 'HMakeDate', title: '制单日期', width: 100 }
                        , { field: 'HQty', title: '数量', width: 100 }
                        , { field: 'HSourceBillNo', title: '源单单号', width: 100 }
                        , { field: 'HRedBlueFlag', title: '红蓝字', width: 100 }
                        , { field: 'HSourceBillType', title: '源单类型', width: 100 }
                    ]]
                      , height: 500
                      , done: function () {
                          layer.closeAll("loading");
                      }
            });
        });
        //table.render({
        //    elem: '#dj-table'
        //    , url: GetWEBURL() + '/Web/chanpinruk'
        //    , toolbar: '#toolbarDemo'
        //    , where: { HBillType: sBillType, sHMaker: sessionStorage["HUserName"], HOrgID: sessionStorage["OrganizationID"] }
        //    , cols: [[
        //        { type: 'radio' }
        //        , { field: 'HInterID', title: '单据内码', width: 120 }
        //        , { field: 'HBillNo', title: '单据号', width: 150 }
        //        , { field: 'HMaker', title: '制单人', width: 120 }
        //        , { field: 'HMakeDate', title: '制单日期', width: 150 }
        //        , { field: 'HQty', title: '数量', width: 100 }
        //        , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
        //        , { field: 'HRedBlueFlag', title: '红蓝字', width: 120 }
        //        , { field: 'HSourceBillType', title: '源单类型', width: 100 }
        //    ]]
        //    , height: 500
        //    , done: function () {
        //        layer.closeAll("loading");
        //    }
        //})
        //动态列
        $.ajax({
            url: GetWEBURL() + "/Web/chanpinruk1",
            type: "GET",
            async: false,
            data: { HBillType: sBillType, sHMaker: sessionStorage["HUserName"], HOrgID: sessionStorage["OrganizationID"] },
            //async: false,
            success: function (data1) {
                if (data1.count == 1) {
                    var data = [];
                    var col = [];
                    //给空的数组赋值
                    for (var key in data1.list) {
                        data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                    }
                    //在列表左边添加勾选框
                    col.push({ type: 'radio', fixed: 'left' });
                    for (var i = 0; i < data.length; i++) {
                        if ($.inArray(data[i].name, "") > -1) {
                            col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                        }
                        else {
                            switch (data[i].Type) {
                                //int
                                case 'DateTime':
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 200 });
                                    break;
                                default:
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
                            }
                        }
                    }
        form.on('submit(cmdDelete)', function () {//删除
            var checkStatus = table.checkStatus('dj-table')
            , data = checkStatus.data;
            // console.log(data);
            // var sInterID = $('#HInterID').val()
            var sInterID = data[0].HInterID
            //var sMaterID = data[0].HMaterID
            //var sBillType = $('#HBillType').val()
            //var sAuxPropID = data[0].HAuxPropID
            ////var sMTONo = data[0].HMTONo
            //var sMTONo = 0
            //var sSourceInterID = data[0].HSourceInterID
            //var sSourceEntryID = data[0].HSourceEntryID
            $.ajax(
               {
                   type: "Get",
                   url: GetWEBURL() + "/Web/Delete_Json",
                   async: true,
                   data: { "sHInterID": sInterID },
                   dataType: "json",
                   success: function (data) {
                       if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                           //layer.msg(data.Message, { icon: 1 });
                           table.render({
                               elem: '#dj-table'
                               , url: GetWEBURL() + '/Web/DisBillEntryList_Mate_Webs_Json'
                               , cellMinWidth: 80
                               , toolbar: '#toolbarDemo'
                               , where: { HBillType: '1206', sWhere: '' }
                               , cols: [[
                                   { type: 'radio' }
                                , { field: 'HInterID', title: '单据内码', width: 80 }
                                , { field: 'HBillNo', title: '单据号', width: 80 }
                                , { field: 'HMaker', title: '制单人', width: 100 }
                                , { field: 'HMakeDate', title: '制单日期', width: 100 }
                                , { field: 'HQty', title: '数量', width: 100 }
                                , { field: 'HSourceBillNo', title: '源单单号', width: 100 }
                                , { field: 'HRedBlueFlag', title: '红蓝字', width: 100 }
                                , { field: 'HSourceBillType', title: '源单类型', width: 100 }
                               ]]
                         , height: 500
                           })
                       }
                       else {
                           layer.msg(data.Message, { icon: 2 });
                       }
                   },
                   error: function (err) {
                       layer.msg('错误' + err, {
                           icon: 5,
                           time: 20000
                       }, function () {
                           //do something
                       });
                   }
               });
        });
        var sBillType = '1206'
                table.render({
                    elem: '#dj-table'
                    , url: GetWEBURL() + '/Web/DisBillEntryList_Mate_Webs_Json'
                    ,toolbar: '#toolbarDemo'
                    , where: { HBillType: sBillType,sWhere:''}
                    , cols: [[
                          { type: 'radio' }
                        , { field: 'HInterID', title: '单据内码', width: 80 }
                        , { field: 'HBillNo', title: '单据号', width: 80 }
                        , { field: 'HMaker', title: '制单人', width: 100 }
                        , { field: 'HMakeDate', title: '制单日期', width: 100 }
                        , { field: 'HQty', title: '数量', width: 100 }
                        , { field: 'HSourceBillNo', title: '源单单号', width: 100 }
                        , { field: 'HRedBlueFlag', title: '红蓝字', width: 100 }
                        , { field: 'HSourceBillType', title: '源单类型', width: 100 }
                    option = {
                        elem: '#dj-table'
                        , toolbar: '#toolbarDemo'
                        , height: 500
                        , page: true //开启分页
                        , limit: 50
                        , limits: [50, 500, 5000, 20000]
                        , cols: [col]
                        , data: data1.data
                    };
                    table.render(option);
                } else {
                    option = {
                        elem: '#dj-table'
                        , toolbar: '#toolbarDemo'
                        , height: 500
                        , page: true //开启分页
                        , limit: 50
                        , limits: [50, 500, 5000, 20000]
                        , cols: [[
                            { type: 'radio' }
                            , { field: 'HMakeDate', title: '制单日期', width: 150 }
                            , { field: 'HBillNo', title: '单据号', width: 150 }
                            , { field: 'HMaterName', title: '物料名称', width: 150 }
                            , { field: 'HQty', title: '数量', width: 100 }
                        ]]
                      , height: 500
                      , done: function () {
                          layer.closeAll("loading");
                      }
    })
                        , data:[]
                    };
                    table.render(option);
                }
            },
            error: function (err) {
                layer.msg('错误' + err, {
                    icon: 5,
                    time: 20000
                }, function () {
                    //do something
                });
            }
        })
        //已上传列表
        table.render({
            elem: '#yd-table'
            , url: GetWEBURL() + '/Web/DisBillUpdateLoad_Json'
            , toolbar: '#toolbarDemo'
            , where: { HBillType: sBillType, HMaker: sessionStorage["HUserName"], HOrgID: sessionStorage["OrganizationID"] }
            , page: true  // å¼€å¯åˆ†é¡µ
            , limits: [20, 40, 80, 100]
            , limit: 20
            , cols: [[
                { type: 'radio' }
                , { field: 'HInterID', title: '单据内码', width: 120 }
                , { field: 'HBillNo', title: '单据号', width: 150 }
                , { field: 'HMaker', title: '制单人', width: 120 }
                , { field: 'HMakeDate', title: '制单日期', width: 150 }
                , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                , { field: 'HMaterName', title: '物料名称', width: 150 }
                , { field: 'HMaterModel', title: '规格型号', width: 150 }
                , { field: 'HQty', title: '数量', width: 100 }
                , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                , { field: 'HOrgID', title: '组织', width: 120 }
            ]]
            , height: 500
            , done: function () {
                layer.closeAll("loading");
            }
        })
        //已上传查询
        table.render({
            elem: '#sy-table'
            , toolbar: '#toolbarDemo'
            , cols: [[
                { type: 'radio' }
                , { field: 'HInterID', title: '单据内码', width: 120 }
                , { field: 'HBillNo', title: '单据号', width: 150 }
                , { field: 'HMaker', title: '制单人', width: 120 }
                , { field: 'HMakeDate', title: '制单日期', width: 150 }
                , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                , { field: 'HMaterName', title: '物料名称', width: 150 }
                , { field: 'HMaterModel', title: '规格型号', width: 150 }
                , { field: 'HQty', title: '数量', width: 100 }
                , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                , { field: 'HOrgID', title: '组织', width: 120 }
            ]]
            , height: 500
        })
        //刷新明细页签
        table.render({
            elem: '#mx-table'