智云SRM-LAYUI(夏宝服务器版本)
王 垚
2021-11-15 a24c56ed180615d62277799f22fefd977521feef
委外订单
2个文件已修改
796 ■■■■■ 已修改文件
WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_EntrustOrderBillList.html 376 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POInStockBill_Edit.html 420 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_EntrustOrderBillList.html
@@ -67,8 +67,8 @@
                                    <label class="layui-form-label">关闭状态</label>
                                    <div class="layui-input-block">
                                        <select id="HClStatus" name="HClStatus" lay-filter="">
                                            <option value="">全部</option>
                                            <option value="未关闭" selected="">未关闭</option>
                                            <option value="" selected="">全部</option>
                                            <option value="未关闭">未关闭</option>
                                            <option value="已关闭">已关闭</option>
                                        </select>
                                    </div>
@@ -89,6 +89,7 @@
                                    <label class="layui-form-label">交货时间</label>
                                    <div class="layui-input-block">
                                        <select id="Time" name="Time" lay-filter="">
                                            <option value="0" selected>全部</option>
                                            <option value="1">一周内交货</option>
                                            <option value="2">二周内交货</option>
                                            <option value="3">一月内交货</option>
@@ -96,7 +97,7 @@
                                            <option value="5">三月内交货</option>
                                            <option value="6">半年内交货</option>
                                            <option value="7">一年内交货</option>
                                            <option value="8" selected="">长期交货</option>
                                            <option value="8">长期交货</option>
                                        </select>
                                    </div>
                                </div>
@@ -113,9 +114,9 @@
                                    <label class="layui-form-label">是否已下推送货单</label>
                                    <div class="layui-input-block">
                                        <select id="HISGenerate" name="HISGenerate" lay-filter="">
                                            <option value="全部">全部</option>
                                            <option value="全部" selected="">全部</option>
                                            <option value="是">是</option>
                                            <option value="否" selected="">否</option>
                                            <option value="否">否</option>
                                        </select>
                                    </div>
                                </div>
@@ -135,6 +136,7 @@
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-reload"><i class="layui-icon layui-icon-refresh"></i>刷新</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-confirm" id="btn_confirm"><i class="layui-icon layui-icon-ok-circle"></i>确认</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-back" id="btn_back"><i class="layui-icon layui-icon-close-fill"></i>驳回</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-report" id="btn_report"><i class="layui-icon layui-icon-close-fill"></i>汇报</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-details"><i class="layui-icon layui-icon-form"></i>详情</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-generate"><i class="layui-icon layui-icon-file"></i>生成送货单</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-exit"><i class="layui-icon layui-icon-return"></i>退出</button>
@@ -147,8 +149,8 @@
            </div>
            </div>
        </div>
    </div>
    <!--<script src="../../layuiadmin/layui/lay/modules/mobile/jquery-3.3.1.min.js"></script>-->
    <script src="../../layuiadmin/layui/layui.js" charset="utf-8"></script>
@@ -203,12 +205,12 @@
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'code', 'table', 'element', 'layer'], function () {
            var $ = layui.$
            , admin = layui.admin
            , layer = layui.layer
            , laydate = layui.laydate
            , table = layui.table
            , form = layui.form
            , element = layui.element;
                , admin = layui.admin
                , layer = layui.layer
                , laydate = layui.laydate
                , table = layui.table
                , form = layui.form
                , element = layui.element;
            //常规用法
            laydate.render({
                elem: '#HDate1'
@@ -229,47 +231,49 @@
                , toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
                , defaultToolbar: ['filter', 'exports', 'print']
                // , where: { msg: "", NowPage: 1, OnePage: 10 }
              , cellMinWidth: 100
              , cols: [[
                //{ checkbox: true, fixed: true }
                 {type: 'checkbox', fixed: 'left'}
                //{ type: 'radio', fixed: true }
                , { field: 'sorderid', title: '序号', width: 80, fixed: true }
                , { field: 'hmainid', title: 'hmainid', sort: true, fixed: true, hide: true }
                , { field: 'hsubid', title: 'hsubid', sort: true, fixed: true, hide: true }
                , { field: '状态', title: '状态', sort: true, fixed: true }
                , { field: '单据号', title: '单据号', width: 180, sort: true, fixed: 'left' }
                , { field: '日期', title: '日期', width: 180, sort: true, fixed: 'left' }
                , { field: '供应商', title: '供应商', width: 180, sort: true, fixed: 'left' }
                , { field: '计划跟踪单号', title: '计划跟踪单号', sort: true, hide: true }
                , { field: '物料代码', title: '物料代码', width: 180, sort: true }
                , { field: '物料名称', title: '物料名称', width: 180, sort: true }
                , { field: '规格型号', title: '规格型号', width: 180, sort:  true }
                , { field: '计量单位', title: '计量单位', width: 80, sort: true }
                , { field: '数量', title: '订货数量', sort: true }
                , { field: '交货地点', title: '交货地点', sort: true }
                , { field: '交货日期', title: '交货日期', width: 180, sort: true }
                , { field: '剩余入库数量', title: '剩余入库数量', sort: true }
                , { field: '剩余收料数量', title: '剩余收料数量', sort: true }
                , { field: '关闭状态', title: '关闭状态', sort: true }
                , { field: '变更状态', title: '变更状态', sort: true }
                , { field: '委外组织', title: '委外组织', sort: true }
                , { field: '确认人', title: '确认人', sort: true, hide: true }
                , { field: '确认日期', title: '确认日期', sort: true, hide: true }
                , { field: '驳回人', title: '驳回人', sort: true, hide: true }
                , { field: '驳回日期', title: '驳回日期', sort: true, hide: true }
                , { field: '驳回理由', title: '驳回理由', sort: true, hide: true }
              ]]
           //, skin: 'row' //表格风格
           // , even: true
            , page: true //是否显示分页
            , limits: [10, 20, 50,100]
            , limit: 50 //每页默认显示的数量
              //, height: 500
            , done: function (res, curr, count) {
                _cur_page = curr;
                layer.closeAll("loading");
            }
                , cellMinWidth: 100
                , cols: [[
                    //{ checkbox: true, fixed: true }
                    { type: 'checkbox', fixed: 'left' }
                    //{ type: 'radio', fixed: true }
                    , { field: 'sorderid', title: '序号', width: 80, fixed: true }
                    , { field: 'hmainid', title: 'hmainid', sort: true, fixed: true, hide: true }
                    , { field: 'hsubid', title: 'hsubid', sort: true, fixed: true, hide: true }
                    , { field: '状态', title: '状态', sort: true, fixed: true }
                    , { field: '反馈状态', title: '反馈状态', width: 100, fixed: true }
                    , { field: '优先级', title: '优先级', width: 100, fixed: true }
                    , { field: '单据号', title: '单据号', width: 180, sort: true, fixed: 'left' }
                    , { field: '日期', title: '日期', width: 180, sort: true, fixed: 'left' }
                    , { field: '供应商', title: '供应商', width: 180, sort: true, fixed: 'left' }
                    , { field: '计划跟踪单号', title: '计划跟踪单号', sort: true, hide: true }
                    , { field: '物料代码', title: '物料代码', width: 180, sort: true }
                    , { field: '物料名称', title: '物料名称', width: 180, sort: true }
                    , { field: '规格型号', title: '规格型号', width: 180, sort: true }
                    , { field: '计量单位', title: '计量单位', width: 80, sort: true }
                    , { field: '数量', title: '订货数量', sort: true }
                    , { field: '交货地点', title: '交货地点', sort: true }
                    , { field: '交货日期', title: '交货日期', width: 180, sort: true }
                    , { field: '剩余入库数量', title: '剩余入库数量', sort: true }
                    , { field: '剩余收料数量', title: '剩余收料数量', sort: true }
                    , { field: '关闭状态', title: '关闭状态', sort: true }
                    , { field: '变更状态', title: '变更状态', sort: true }
                    , { field: '委外组织', title: '委外组织', sort: true }
                    , { field: '确认人', title: '确认人', sort: true, hide: true }
                    , { field: '确认日期', title: '确认日期', sort: true, hide: true }
                    , { field: '驳回人', title: '驳回人', sort: true, hide: true }
                    , { field: '驳回日期', title: '驳回日期', sort: true, hide: true }
                    , { field: '驳回理由', title: '驳回理由', sort: true, hide: true }
                ]]
                //, skin: 'row' //表格风格
                // , even: true
                , page: true //是否显示分页
                , limits: [10, 20, 50, 100]
                , limit: 50 //每页默认显示的数量
                //, height: 500
                , done: function (res, curr, count) {
                    _cur_page = curr;
                    layer.closeAll("loading");
                }
            });
            //头工具栏事件
@@ -281,20 +285,20 @@
                        layer.alert(JSON.stringify(data));
                        break;
                        //自定义头工具栏右侧图标 - 提示
                    //自定义头工具栏右侧图标 - 提示
                    case 'btn-reload':
                        _cur_page = $(".layui-laypage-em").next().html();
                        RoadHBillNo(sql);
                            break;
                        break;
                    case 'btn-confirm':
                        var checkStatus = table.checkStatus('mainTable')
                         , data = checkStatus.data;
                            , data = checkStatus.data;
                        _cur_page = $(".layui-laypage-em").next().html();
                        if (data[0]["状态"] == "未确认") {
                            layer.confirm('是否确认单据?', { icon: 3, title: '提示' }, function (index) {
                                $.ajax({
                                    type: "get",
                                    url: GetWEBURL()+"EntrustOrderAccept",
                                    url: GetWEBURL() + "EntrustOrderAccept",
                                    data: { "HInterID": data[0]["hmainid"].toString(), "HBillNo": data[0]["单据号"].toString(), "HUser": sessionStorage["HUserName"] },
                                    success: function (result) {
                                        if (result.count == 1) { // 说明验证成功了,
@@ -311,7 +315,7 @@
                                layer.close(index);
                            });
                        }
                        else {
                            layer.msg("必须是未确认单据才能进行确认操作!", { icon: 5 });
@@ -319,37 +323,37 @@
                        break;
                    case 'btn-back':
                        var checkStatus = table.checkStatus('mainTable')
                       , data = checkStatus.data;
                            , data = checkStatus.data;
                        _cur_page = $(".layui-laypage-em").next().html();
                        var HBackRemark;
                        if (data[0]["状态"] == "未确认") {
                                layer.prompt({
                                    formType: 2,
                                    //value: '',
                                    title: '请输入驳回理由',
                                    area: ['400px', '200px'] //自定义文本域宽高
                                }, function (value, index, elem) {
                                    HBackRemark = value.toString();
                                    $.ajax({
                                        type: "get",
                                        url: GetWEBURL()+"EntrustOrderRefuse",
                                        data: { "HInterID": data[0]["hmainid"].toString(), "HBillNo": data[0]["单据号"].toString(), "HUser": sessionStorage["HUserName"], "HBackRemark": HBackRemark },
                                        success: function (result) {
                                            if (result.count == 1) { // 说明验证成功了,
                                                layer.msg("拒绝成功!", { icon: 1 });
                                                RoadHBillNo(sql);
                                            }
                                            else {
                                                // $("#verifycode").click();
                                                layer.msg(result.Message, { icon: 5 });
                                            }
                                            layer.closeAll("loading");
                            layer.prompt({
                                formType: 2,
                                //value: '',
                                title: '请输入驳回理由',
                                area: ['400px', '200px'] //自定义文本域宽高
                            }, function (value, index, elem) {
                                HBackRemark = value.toString();
                                $.ajax({
                                    type: "get",
                                    url: GetWEBURL() + "EntrustOrderRefuse",
                                    data: { "HInterID": data[0]["hmainid"].toString(), "HBillNo": data[0]["单据号"].toString(), "HUser": sessionStorage["HUserName"], "HBackRemark": HBackRemark },
                                    success: function (result) {
                                        if (result.count == 1) { // 说明验证成功了,
                                            layer.msg("拒绝成功!", { icon: 1 });
                                            RoadHBillNo(sql);
                                        }
                                    })
                                    //alert(value); //得到value
                                    layer.close(index);
                                });
                                        else {
                                            // $("#verifycode").click();
                                            layer.msg(result.Message, { icon: 5 });
                                        }
                                        layer.closeAll("loading");
                                    }
                                })
                                //alert(value); //得到value
                                layer.close(index);
                            });
                        }
                        else {
@@ -358,7 +362,7 @@
                        break;
                    case 'btn-details':
                        var checkStatus = table.checkStatus('mainTable')
                       , data = checkStatus.data;
                            , data = checkStatus.data;
                        var linterid = data[0].hmainid.toString();
                        //if (AllowLoadData(sSubStr) != false) {//非空验证
@@ -378,7 +382,7 @@
                        break;
                    case 'btn-generate':
                        var checkStatus = table.checkStatus('mainTable')
                        , data = checkStatus.data;
                            , data = checkStatus.data;
                        ajaxLabelData = data;
                        var rows = '';
                        var HEntry = '';
@@ -387,31 +391,100 @@
                                rows += data[i].hmainid.toString() + ',' + data[i].hsubid.toString() + ';';
                            }
                            else {
                                HEntry += (i+1) + ',';
                                HEntry += (i + 1) + ',';
                            }
                        }
                        if (HEntry != '') {
                            HEntry = HEntry.substring(0, HEntry.length - 1);
                            layer.msg("第" + HEntry + "行未确认!", { icon: 5 });
                        }
                        else{
                        layer.open({
                            type: 2
                            , area: ['100%', '100%']
                            , title: '送货单'
                            , shade: 0.6 //遮罩透明度
                            , maxmin: false //允许全屏最小化
                            , anim: 0 //0-6的动画形式,-1不开启
                            , content: ['../../views/SRM/SRM_POInStockBill_Edit.html?linterid=' + data[0].hmainid.toString() + '&lentryid=' + rows.toString() + '&lSourceBillType=1601', 'yes']
                            , resize: false
                            //, cancel: function () {
                            //    $(".layui-btn").removeClass("layui-btn-disabled");
                            //}
                        })
                        else {
                            layer.open({
                                type: 2
                                , area: ['100%', '100%']
                                , title: '送货单'
                                , shade: 0.6 //遮罩透明度
                                , maxmin: false //允许全屏最小化
                                , anim: 0 //0-6的动画形式,-1不开启
                                , content: ['../../views/SRM/SRM_POInStockBill_Edit.html?linterid=' + data[0].hmainid.toString() + '&lentryid=' + rows.toString() + '&lSourceBillType=1601', 'yes']
                                , resize: false
                                //, cancel: function () {
                                //    $(".layui-btn").removeClass("layui-btn-disabled");
                                //}
                            })
                        }
                        break;
                    case 'btn-exit':
                        parent.layui.admin.events.closeThisTabs();
                        break;
                    case 'btn-report':
                        var checkStatus = table.checkStatus('mainTable')
                            , data = checkStatus.data;
                        _cur_page = $(".layui-laypage-em").next().html();
                        var arr = new Array();
                        var checkStatus = table.checkStatus('mainTable'),
                            data = checkStatus.data;
                        if (checkStatus.data.length == 0) {
                            return layer.msg('请选择数据');
                        }
                        for (var i = 0; i < data.length; i++) {
                            arr.push(data[i].hmainid + '-' + data[i].hsubid);
                        }
                        var OrderBackId = "";
                        layer.open({
                            type: 2,
                            skin: 'layui-layer-rim', //加上边框
                            title: '订单反馈状态',
                            closeBtn: 1,
                            shift: 2,
                            area: ['80%', '80%'],
                            maxmin: true,
                            content: ['../PublicPage/OrderBackInfomation.html', 'yes'],
                            btn: ['确定', '取消']
                            , btn1: function (index, layero) {
                                //按钮【按钮一】的回调
                                var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                                var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                                if (checkStatus.data.length === 0) {
                                    return layer.msg('请选择数据');
                                }
                                OrderBackId = checkStatus.data[0].HItemID.toString();
                                $.ajax({
                                    url: GetWEBURL() + 'EntrustOrderBack',
                                    //url: 'http://localhost:8082/LuBaoAPI/' + 'POOrderBack',
                                    async: false,
                                    type: "GET",
                                    dataType: "json",
                                    data: { "HmainidList": arr.toString(), "OrderBackId": OrderBackId },
                                    success: function (data1) {
                                        if (data1.Message.indexOf("成功") > 0) {
                                            layer.msg("操作成功", { time: 3 * 1000, icon: 1 }, function () {
                                                var index = layer.getFrameIndex(window.name);
                                                //关闭当前frame
                                                layer.close(index);
                                                //修改为功后刷新界面
                                                window.location.reload();
                                            });
                                        } else {
                                            layer.alert(data1.Message, { icon: 5 });
                                        }
                                    }, error: function (e) {
                                        layer.alert(data1.Message, { icon: 5 });
                                    }
                                });
                            }
                            , btn2: function (index, layero) {
                                //按钮【按钮二】的回调
                                //return false 开启该代码可禁止点击该按钮关闭
                            },
                            end: function () {
                            },
                            success: function (layero, index) {
                            }
                        });
                        break;
                };
            });
@@ -419,11 +492,11 @@
            ///加载显示数据
            function RoadHBillNo (sqlWhere) {
            function RoadHBillNo(sqlWhere) {
                where = sqlWhere;
                $.ajax({
                    type: "get",
                    url: GetWEBURL()+"GetEntrustOrderBill",
                    url: GetWEBURL() + "GetEntrustOrderBill",
                    async: true,
                    data: { "HSupNo": sessionStorage["HUserName"], "sqlWhere": sqlWhere },
                    success: function (result) {
@@ -477,70 +550,71 @@
                    }
                }
                var Time = $("#Time").val();
                var dd = new Date();
                var dt;
                switch (Time)
                {
                    case 1:    dd = new Date(dd.setDate(dd.getDate() + 7));
                    case 2:    dd = new Date(dd.setDate(dd.getDate() + 14));
                    case 3:    dd = new Date(dd.setMonth(dd.getMonth() + 1));
                    case 4:    dd = new Date(dd.setMonth(dd.getMonth() + 2));
                    case 5:    dd = new Date(dd.setMonth(dd.getMonth() + 3));
                    case 6:    dd = new Date(dd.setMonth(dd.getMonth() + 6));
                    case 7:    dd = new Date(dd.setMonth(dd.getMonth() + 12));
                    default:    dd = new Date(dd.setDate(dd.getDate()));
                }
                dt = dd.getFullYear().toString();
                if (dd.getMonth() + 1 < 10) {
                    dt = dt + "-0" + (dd.getMonth() + 1).toString();
                }
                else {
                    dt = dt + "-0" + (dd.getMonth() + 1).toString();
                }
                if (dd.getDate() < 10) {
                    dt = dt + "-0" + dd.getDate().toString();
                }
                else {
                    dt = dt + "-" + dd.getDate().toString();
                }
                if (Time != 8) {
                    sqlWhere += " and 交货日期 <= ^^" + dt + "^^";
                if (Time > 0) {
                    var dd = new Date();
                    var dt;
                    switch (Time) {
                        case 1: dd = new Date(dd.setDate(dd.getDate() + 7));
                        case 2: dd = new Date(dd.setDate(dd.getDate() + 14));
                        case 3: dd = new Date(dd.setMonth(dd.getMonth() + 1));
                        case 4: dd = new Date(dd.setMonth(dd.getMonth() + 2));
                        case 5: dd = new Date(dd.setMonth(dd.getMonth() + 3));
                        case 6: dd = new Date(dd.setMonth(dd.getMonth() + 6));
                        case 7: dd = new Date(dd.setMonth(dd.getMonth() + 12));
                        default: dd = new Date(dd.setDate(dd.getDate()));
                    }
                    dt = dd.getFullYear().toString();
                    if (dd.getMonth() + 1 < 10) {
                        dt = dt + "-0" + (dd.getMonth() + 1).toString();
                    }
                    else {
                        dt = dt + "-0" + (dd.getMonth() + 1).toString();
                    }
                    if (dd.getDate() < 10) {
                        dt = dt + "-0" + dd.getDate().toString();
                    }
                    else {
                        dt = dt + "-" + dd.getDate().toString();
                    }
                    if (Time != 8) {
                        sqlWhere += " and 交货日期 <= ^^" + dt + "^^";
                    }
                }
                sql = sqlWhere;
                //从第一页开始
                _cur_page = 1;
                RoadHBillNo(sqlWhere);
        });
            });
            var $ = layui.$, active = {
                f_Query: function () { //查询
                },
                f_Qrjq: function () { //接受
                },
                f_Bhjq: function () { //拒绝
                },
                    //JSreload: function () {
                    //    var demoReload = $('#test-table-demoReload');
                    //    //执行重载
                    //    table.JSreload('test-table-reload', {
                    //        page: {
                    //            curr: 1 //重新从第 1 页开始
                    //        }
                    //      , where: {
                    //          key: {
                    //              id: demoReload.val()
                    //          }
                    //      }
                    //    });
                    //}
                };
                //JSreload: function () {
                //    var demoReload = $('#test-table-demoReload');
                //    //执行重载
                //    table.JSreload('test-table-reload', {
                //        page: {
                //            curr: 1 //重新从第 1 页开始
                //        }
                //      , where: {
                //          key: {
                //              id: demoReload.val()
                //          }
                //      }
                //    });
                //}
            };
            $('.test-table-reload-btn .layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
          });
        });
    </script>
</body>
</html>
WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POInStockBill_Edit.html
@@ -130,55 +130,55 @@
                                            </div>
                                        </div>
                                    </div>
                                            <div class="layui-tab-item">
                                                <div class="layui-form-item">
                                                    <div class="layui-row">
                                                        <div class="layui-col-xs3">
                                                            <label class="layui-form-label">制 单 人:</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input" name="HMaker" id="HMaker" readonly="readonly" autocomplete="off">
                                                            </div>
                                                        </div>
                                                        <div class="layui-col-xs3">
                                                            <label class="layui-form-label">审 核 人:</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input" name="HChecker" id="HChecker" readonly="readonly" autocomplete="off">
                                                            </div>
                                                        </div>
                                                        <div class="layui-col-xs3">
                                                            <label class="layui-form-label">变 更 人:</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input" name="HUpDater" id="HUpDater" readonly="readonly" autocomplete="off">
                                                            </div>
                                                        </div>
                                    <div class="layui-tab-item">
                                        <div class="layui-form-item">
                                            <div class="layui-row">
                                                <div class="layui-col-xs3">
                                                    <label class="layui-form-label">制 单 人:</label>
                                                    <div class="layui-input-inline">
                                                        <input class="layui-input" name="HMaker" id="HMaker" readonly="readonly" autocomplete="off">
                                                    </div>
                                                </div>
                                                <div class="layui-form-item">
                                                    <div class="layui-row">
                                                        <div class="layui-col-xs3">
                                                            <label class="layui-form-label">制单日期:</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input" name="HMakeDate" id="HMakeDate" readonly="readonly" autocomplete="off">
                                                            </div>
                                                        </div>
                                                        <div class="layui-col-xs3">
                                                            <label class="layui-form-label">审核日期:</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input" name="HCheckDate" id="HCheckDate" readonly="readonly" autocomplete="off">
                                                            </div>
                                                        </div>
                                                        <div class="layui-col-xs3">
                                                            <label class="layui-form-label">变更日期:</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input" name="HUpDateDate" id="HUpDateDate" readonly="readonly" autocomplete="off">
                                                            </div>
                                                        </div>
                                                <div class="layui-col-xs3">
                                                    <label class="layui-form-label">审 核 人:</label>
                                                    <div class="layui-input-inline">
                                                        <input class="layui-input" name="HChecker" id="HChecker" readonly="readonly" autocomplete="off">
                                                    </div>
                                                </div>
                                                <div class="layui-col-xs3">
                                                    <label class="layui-form-label">变 更 人:</label>
                                                    <div class="layui-input-inline">
                                                        <input class="layui-input" name="HUpDater" id="HUpDater" readonly="readonly" autocomplete="off">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-row">
                                                <div class="layui-col-xs3">
                                                    <label class="layui-form-label">制单日期:</label>
                                                    <div class="layui-input-inline">
                                                        <input class="layui-input" name="HMakeDate" id="HMakeDate" readonly="readonly" autocomplete="off">
                                                    </div>
                                                </div>
                                                <div class="layui-col-xs3">
                                                    <label class="layui-form-label">审核日期:</label>
                                                    <div class="layui-input-inline">
                                                        <input class="layui-input" name="HCheckDate" id="HCheckDate" readonly="readonly" autocomplete="off">
                                                    </div>
                                                </div>
                                                <div class="layui-col-xs3">
                                                    <label class="layui-form-label">变更日期:</label>
                                                    <div class="layui-input-inline">
                                                        <input class="layui-input" name="HUpDateDate" id="HUpDateDate" readonly="readonly" autocomplete="off">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                        <script type="text/html" id="toolbarDemo">
@@ -190,7 +190,7 @@
                        <blockquote class="layui-elem-quote">送货单</blockquote>
                    </form>
                </div>
                        </div>
            </div>
        </div>
    </div>
    <!--<script src="../../layuiadmin/layui/lay/modules/mobile/jquery-3.3.1.min.js"></script>-->
@@ -216,7 +216,7 @@
        var lSourceBillType = params[params[2]];
        // debugger;
        $.ajax({
            url: GetWEBURL()+"GetNewPOInStockBillNo",
            url: GetWEBURL() + "GetNewPOInStockBillNo",
            type: "GET",
            data: { "sMsg": linterid, "sMsg3": lSourceBillType },
            success: function (d) {
@@ -226,7 +226,7 @@
            }
        });
        $.ajax({
            url: GetWEBURL()+"GetNewPOInStockShowBillMain",
            url: GetWEBURL() + "GetNewPOInStockShowBillMain",
            type: "GET",
            data: { "sMsg": linterid, "sMsg3": lSourceBillType },
            success: function (d) {
@@ -258,15 +258,15 @@
            index: 'lib/index' //主入口模块
        }).use(['index', 'table', 'form', 'element', 'layer', 'laydate'], function () {
            var table = layui.table
            , $ = layui.$
            , form = layui.form
            , layer = layui.layer
            , laydate = layui.laydate
            , element = layui.element; //Tab的切换功能,切换事件监听等,需要依赖element模块
                , $ = layui.$
                , form = layui.form
                , layer = layui.layer
                , laydate = layui.laydate
                , element = layui.element; //Tab的切换功能,切换事件监听等,需要依赖element模块
            //常规用法
            laydate.render({
                elem: '#HDHDate'
            });
            });
            //监听提交
            //form.verify({
            //    numberOrEmpty: function (value, item) {
@@ -281,57 +281,57 @@
            layer.load(3)
            table.render({
                elem: '#mainTable'
              //, url: GetWEBURL()+'GetNewPOInStockShowBillSub'
              , toolbar: '#toolbarDemo'
             //, where: { sMsg: linterid, sMsg2: lentryid, sMsg3: lSourceBillType }
             // , where: { sMsg: '28', sMsg2: '28,5;' }
              , cols: [[
                  { type: 'checkbox', fixed: 'left' }
                , { field: 'sorderid', title: '序号', width: 80,  hide: true ,fixed: true }
                , { field: 'HMTONO', title: '计划跟踪单号', width: 100, fixed: true ,edit: 'text', hide: true }
                , { field: 'HMaterID', title: '物料ID', width: 100, hide: true }
                , { field: 'HMaterNumber', title: '物料代码', width: 100}
                , { field: 'HMaterName', title: '物料名称', width: 200 }
                , { field: 'HMaterModel', title: '规格型号', width: 200 }
                , { field: 'HUnitName', title: '计量单位', width: 100}
                , { field: 'HUnitNumber', title: '计量单位代码', width: 100, hide: true }
                , { field: 'HUnitID', title: '计量单位ID', width: 100, hide: true }
                , { field: 'HQty', title: '送货数量', width: 100, edit: 'text', event: "inputHQty" }
                , { field: 'HRQty', title: '未入库数量', width: 100}
                , { field: 'HSQty', title: '源单数量', width: 100 }
                , { field: 'HBatchNo', title: '批次', width: 100, edit: 'text' }
                , { field: 'HKFDate', title: '生产日期', align: 'center', width: 150, data_field: 'HKFDate', event: "chooseHKFDate" }
                , { field: 'HKFPeriod', title: '保质期', width: 100}
                , { field: 'HDate', title: '预计到货日期', align: 'center', width: 150, data_field: 'HDate', event: "chooseHDate", hide: true }
                , { field: 'HPrice', title: '单价', width: 100 }
                , { field: 'HMoney', title: '金额', width: 100 }
                //, { field: 'HRemark', title: '备注', width: 100 }
                , { field: 'HPOOrderInterID', title: '采购订单主内码', width: 150, hide: true }
                , { field: 'HPOOrderEntryID', title: '采购订单子内码', width: 150, hide: true }
                , { field: 'HPOOrderBillNo', title: '采购订单号', width: 200 }
                , { field: 'HWWOrderInterID', title: '委外订单主内码', width: 150, hide: true }
                , { field: 'HWWOrderEntryID', title: '委外订单子内码', width: 150, hide: true }
                , { field: 'HWWOrderBillNo', title: '委外订单号', width: 200 }
                , { field: 'HBillType', title: '单据类型', width: 100, hide: true }
                , { field: 'HSourceBillType', title: '源单类型', width: 100, hide: true }
                , { field: 'HSourceBillNo', title: '源单单号', width: 200 }
                , { field: 'HSourceInterID', title: '源单主内码', width: 150, hide: true }
                , { field: 'HSourceEntryID', title: '源单子内码', width: 150, hide: true }
                //, url: GetWEBURL()+'GetNewPOInStockShowBillSub'
                , toolbar: '#toolbarDemo'
                //, where: { sMsg: linterid, sMsg2: lentryid, sMsg3: lSourceBillType }
                // , where: { sMsg: '28', sMsg2: '28,5;' }
                , cols: [[
                    { type: 'checkbox', fixed: 'left' }
                    , { field: 'sorderid', title: '序号', width: 80, hide: true, fixed: true }
                    , { field: 'HMTONO', title: '计划跟踪单号', width: 100, fixed: true, edit: 'text', hide: true }
                    , { field: 'HMaterID', title: '物料ID', width: 100, hide: true }
                    , { field: 'HMaterNumber', title: '物料代码', width: 100 }
                    , { field: 'HMaterName', title: '物料名称', width: 200 }
                    , { field: 'HMaterModel', title: '规格型号', width: 200 }
                    , { field: 'HUnitName', title: '计量单位', width: 100 }
                    , { field: 'HUnitNumber', title: '计量单位代码', width: 100, hide: true }
                    , { field: 'HUnitID', title: '计量单位ID', width: 100, hide: true }
                    , { field: 'HQty', title: '送货数量', width: 100, edit: 'text', event: "inputHQty" }
                    , { field: 'HRQty', title: '未入库数量', width: 100 }
                    , { field: 'HSQty', title: '源单数量', width: 100 }
                    , { field: 'HBatchNo', title: '批次', width: 100, edit: 'text' }
                    , { field: 'HKFDate', title: '生产日期', align: 'center', width: 150, data_field: 'HKFDate', event: "chooseHKFDate" }
                    , { field: 'HKFPeriod', title: '保质期', width: 100 }
                    , { field: 'HDate', title: '预计到货日期', align: 'center', width: 150, data_field: 'HDate', event: "chooseHDate", hide: true }
                    , { field: 'HPrice', title: '单价', width: 100 }
                    , { field: 'HMoney', title: '金额', width: 100 }
                    //, { field: 'HRemark', title: '备注', width: 100 }
                    , { field: 'HPOOrderInterID', title: '采购订单主内码', width: 150, hide: true }
                    , { field: 'HPOOrderEntryID', title: '采购订单子内码', width: 150, hide: true }
                    , { field: 'HPOOrderBillNo', title: '采购订单号', width: 200 }
                    , { field: 'HWWOrderInterID', title: '委外订单主内码', width: 150, hide: true }
                    , { field: 'HWWOrderEntryID', title: '委外订单子内码', width: 150, hide: true }
                    , { field: 'HWWOrderBillNo', title: '委外订单号', width: 200 }
                    , { field: 'HBillType', title: '单据类型', width: 100, hide: true }
                    , { field: 'HSourceBillType', title: '源单类型', width: 100, hide: true }
                    , { field: 'HSourceBillNo', title: '源单单号', width: 200 }
                    , { field: 'HSourceInterID', title: '源单主内码', width: 150, hide: true }
                    , { field: 'HSourceEntryID', title: '源单子内码', width: 150, hide: true }
               //// , { field: 'HCheckDate', title: '审核日期', width: 150 }
               // , { field: 'HChecker', title: '审核人', width: 100 }
               // , { field: 'HSupID', title: '供应商ID', width: 150 }
               // , { field: 'HManagerID', title: '主管ID', width: 100 }
               // , { field: 'HEmpID', title: '职员ID', width: 100 }
               // , { field: 'HMaker', title: '制单人', width: 100 }
              ]]
              // , data: [linterid]
                    //// , { field: 'HCheckDate', title: '审核日期', width: 150 }
                    // , { field: 'HChecker', title: '审核人', width: 100 }
                    // , { field: 'HSupID', title: '供应商ID', width: 150 }
                    // , { field: 'HManagerID', title: '主管ID', width: 100 }
                    // , { field: 'HEmpID', title: '职员ID', width: 100 }
                    // , { field: 'HMaker', title: '制单人', width: 100 }
                ]]
                // , data: [linterid]
                // , page: true
            , limit: 500 //每页默认显示的数量
              //, height: 500
              , done: function () {
                     layer.closeAll("loading");
                 }
                , limit: 500 //每页默认显示的数量
                //, height: 500
                , done: function () {
                    layer.closeAll("loading");
                }
            });
            //事件监听
            //layui.table.on("tool(mainTable)", function (obj) {
@@ -347,7 +347,7 @@
                    case "btn-add":
                        var oldData = table.cache["mainTable"];
                        var checkStatus = table.checkStatus('mainTable')
                        , data = checkStatus.data;
                            , data = checkStatus.data;
                        var rows = '';
                        for (var i = 0; i < data.length; i++) {
                            rows += data[i].HMaterID.toString() + ',';
@@ -369,7 +369,7 @@
                                var count = parseInt(HRowCount);
                                if (count > 1) {
                                    var data1;
                                    var dataindex=0;
                                    var dataindex = 0;
                                    for (var i = 0; i < data.length; i++) {
                                        for (var j = 0; j < oldData.length; j++) {
@@ -379,34 +379,34 @@
                                                    //dataindex = dataindex + x;
                                                    data1 = {
                                                        "sorderid": oldData.length + 1
                                                ,"HMaterID": data[i].HMaterID
                                                , "HMaterNumber": data[i].HMaterNumber
                                                , "HMaterName": data[i].HMaterName
                                                , "HMaterModel": data[i].HMaterModel
                                                , "HUnitName": data[i].HUnitName
                                                , "HUnitNumber": data[i].HUnitNumber
                                                , "HUnitID": data[i].HUnitID
                                                , "HQty": data[i].HQty
                                                , "HRQty": data[i].HRQty
                                                , "HSQty": data[i].HSQty
                                                , "HBatchNo": data[i].HBatchNo
                                                , "HKFDate": data[i].HKFDate
                                                , "HKFPeriod": data[i].HKFPeriod
                                                , "HPrice": data[i].HPrice
                                                , "HMoney": data[i].HMoney
                                                , "HPOOrderInterID": data[i].HPOOrderInterID
                                                , "HPOOrderEntryID": data[i].HPOOrderEntryID
                                                , "HPOOrderBillNo": data[i].HPOOrderBillNo
                                                , "HWWOrderInterID": data[i].HWWOrderInterID
                                                , "HWWOrderEntryID": data[i].HWWOrderEntryID
                                                , "HWWOrderBillNo": data[i].HWWOrderBillNo
                                                , "HBillType": data[i].HBillType
                                                , "HSourceBillType": data[i].HSourceBillType
                                                , "HSourceBillNo": data[i].HSourceBillNo
                                                , "HSourceInterID": data[i].HSourceInterID
                                                , "HSourceEntryID": data[i].HSourceEntryID
                                                , "HMTONO": data[i].HMTONO
                                                , "HDate": data[i].HDate
                                                        , "HMaterID": data[i].HMaterID
                                                        , "HMaterNumber": data[i].HMaterNumber
                                                        , "HMaterName": data[i].HMaterName
                                                        , "HMaterModel": data[i].HMaterModel
                                                        , "HUnitName": data[i].HUnitName
                                                        , "HUnitNumber": data[i].HUnitNumber
                                                        , "HUnitID": data[i].HUnitID
                                                        , "HQty": data[i].HQty
                                                        , "HRQty": data[i].HRQty
                                                        , "HSQty": data[i].HSQty
                                                        , "HBatchNo": data[i].HBatchNo
                                                        , "HKFDate": data[i].HKFDate
                                                        , "HKFPeriod": data[i].HKFPeriod
                                                        , "HPrice": data[i].HPrice
                                                        , "HMoney": data[i].HMoney
                                                        , "HPOOrderInterID": data[i].HPOOrderInterID
                                                        , "HPOOrderEntryID": data[i].HPOOrderEntryID
                                                        , "HPOOrderBillNo": data[i].HPOOrderBillNo
                                                        , "HWWOrderInterID": data[i].HWWOrderInterID
                                                        , "HWWOrderEntryID": data[i].HWWOrderEntryID
                                                        , "HWWOrderBillNo": data[i].HWWOrderBillNo
                                                        , "HBillType": data[i].HBillType
                                                        , "HSourceBillType": data[i].HSourceBillType
                                                        , "HSourceBillNo": data[i].HSourceBillNo
                                                        , "HSourceInterID": data[i].HSourceInterID
                                                        , "HSourceEntryID": data[i].HSourceEntryID
                                                        , "HMTONO": data[i].HMTONO
                                                        , "HDate": data[i].HDate
                                                    }
                                                    //oldData.push(data1);
                                                    oldData.splice(dataindex, 0, data1);
@@ -431,7 +431,7 @@
                    case "btn-del":
                        var oldData = table.cache["mainTable"];
                        var checkStatus = table.checkStatus('mainTable')
                        , data = checkStatus.data;
                            , data = checkStatus.data;
                        var rows = '';
@@ -443,17 +443,15 @@
                            layer.msg("至少选择一行记录!")
                        }
                        else
                        {
                        else {
                            layer.confirm('是否确认?', { icon: 3, title: '提示' }, function (index) {
                                for (var i = 0; i < data.length; i++) {
                                    for (var j = 0; j < oldData.length; j++) {
                                        if(data[i].sorderid==oldData[j].sorderid)
                                        {
                                        if (data[i].sorderid == oldData[j].sorderid) {
                                            oldData.splice(j, 1);
                                            break;
                                        }
                                        }
                                    }
                                }
                                table.reload('mainTable', {
@@ -474,26 +472,28 @@
                    var field = $(this).data('field');
                    laydate.render({
                        elem: this.firstChild
                      , show: true //直接显示
                      , closeStop: this
                      , done: function (value, date) {
                          data[field] = value;
                          obj.update(data);
                        , show: true //直接显示
                        , closeStop: this
                        , done: function (value, date) {
                            data[field] = value;
                            obj.update(data);
                      }});
                        }
                    });
                }
                else if (obj.event === 'chooseHDate'){
                else if (obj.event === 'chooseHDate') {
                    var field = $(this).data('field');
                    laydate.render({
                        elem: this.firstChild
                      , show: true //直接显示
                      , closeStop: this
                      , done: function (value, date) {
                          data[field] = value;
                          obj.update(data);
                        , show: true //直接显示
                        , closeStop: this
                        , done: function (value, date) {
                            data[field] = value;
                            obj.update(data);
                      }});
                        }
                    });
                }
                else if (obj.event == 'inputHQty') {
@@ -503,7 +503,7 @@
                        $input.val(val.replace(/[^\d]/g, ''));
                    });
                }
            });
            //table.on('tool(mainTable)', function (d) {
            //          switch (d.event) {
@@ -518,8 +518,8 @@
            //});
            table.on('edit(mainTable)', function (obj) { //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值"
                var value = obj.value //得到修改后的值
                   ,data = obj.data //得到所在行所有键值
                   , field = obj.field; //得到字段
                    , data = obj.data //得到所在行所有键值
                    , field = obj.field; //得到字段
                var oldData = table.cache["mainTable"];
                var HQty = 0;
                if (obj.field == "HQty") {
@@ -532,25 +532,21 @@
                    else {
                        var bresult = true;
                        var SumQty = 0;
                        for (var i = 0; i < oldData.length; i++)
                        {
                            if(oldData[i].HMaterID==obj.data.HMaterID&&oldData[i].HSourceInterID==obj.data.HSourceInterID&&oldData[i].HSourceEntryID==obj.data.HSourceEntryID)
                            {
                        for (var i = 0; i < oldData.length; i++) {
                            if (oldData[i].HMaterID == obj.data.HMaterID && oldData[i].HSourceInterID == obj.data.HSourceInterID && oldData[i].HSourceEntryID == obj.data.HSourceEntryID) {
                                SumQty = SumQty + parseFloat(oldData[i].HQty);
                            }
                        }
                        if (SumQty > obj.data.HRQty)
                        {
                        if (SumQty > obj.data.HRQty) {
                            bresult = false;
                        }
                        if (bresult){
                        obj.update({
                            HMoney: parseFloat(obj.data.HPrice) * parseFloat(obj.value),
                        });
                        if (bresult) {
                            obj.update({
                                HMoney: parseFloat(obj.data.HPrice) * parseFloat(obj.value),
                            });
                        }
                        else
                        {
                        else {
                            layer.msg("错误:" + "下推送货单,合计送货数量不能超过未入库数量!", { icon: 5 });
                        }
                    }
@@ -585,27 +581,31 @@
                //debugger;
                var sMainStr = JSON.stringify(data.field);
                var sSubStr = JSON.stringify(table.cache['mainTable']);
                var sMainSub = sMainStr + ';' + sSubStr;
                $.ajax(
                var sMainSub = sMainStr + ';' + sSubStr;
                if (!AllowLoadData(sSubStr))//数据验证
                {
                    type: "POST",
                    url: GetWEBURL()+"SaverPOInStock", //方法所在页面和方法名
                    async: true,
                    data: {"msg": sMainSub  },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) { // 说明验证成功了,
                            layer.msg(data.Message, { icon: 1 });
                    return false;
                }
                $.ajax(
                    {
                        type: "POST",
                        url: GetWEBURL() + "SaverPOInStock", //方法所在页面和方法名
                        async: true,
                        data: { "msg": sMainSub },
                        dataType: "json",
                        success: function (data) {
                            if (data.count == 1) { // 说明验证成功了,
                                layer.msg(data.Message, { icon: 1 });
                            }
                            else {
                                f_alert(data.Message);
                            }
                            layer.closeAll("loading");
                        },
                        error: function (err) {
                            f_alert("错误:" + err);
                        }
                        else {
                            f_alert(data.Message);
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        f_alert("错误:" + err);
                    }
                });
                    });
            });
            form.on('submit(Exit)', function (data) {//保存
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
@@ -616,26 +616,26 @@
                //jiuajax从服务器获取
                layer.load(3)
                $.ajax(
                {
                    type: "POST",
                    url: GetWEBURL()+"SaverPOInStock", //方法所在页面和方法名
                    async:true,
                    data: { msg: sMainSub },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) { // 说明验证成功了,
                            layer.msg(data.Message, { icon: 1 });
                    {
                        type: "POST",
                        url: GetWEBURL() + "SaverPOInStock", //方法所在页面和方法名
                        async: true,
                        data: { msg: sMainSub },
                        dataType: "json",
                        success: function (data) {
                            if (data.count == 1) { // 说明验证成功了,
                                layer.msg(data.Message, { icon: 1 });
                            }
                            else {
                                // $("#verifycode").click();
                                f_alert(data.Message);
                            }
                            layer.closeAll("loading");
                        },
                        error: function (err) {
                            f_alert("错误:" + err);
                        }
                        else {
                            // $("#verifycode").click();
                            f_alert(data.Message);
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        f_alert("错误:" + err);
                    }
                });
                    });
            }
            function f_alert(sMsg) {
                layer.alert(sMsg, { icon: 5 });
@@ -650,6 +650,17 @@
                //  }
                //});
            }
            //非空验证
            function AllowLoadData(sSubStr) {
                var Result = true;
                if ($("#HDHDate").val() == '' || $("#HDHDate").val() == null) {
                    layer.msg("预计到货日期不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return Result = false;
                }
                return Result;
            }
            //function form2json() {
            //    var jsonuserinfo = jQuery('#form1').serializeObject();
            //    return JSON.stringify(jsonuserinfo).replace(/(")/g, "\\\"");
@@ -676,7 +687,7 @@
            //    return JSON.stringify(ajaxData).replace(/(")/g, "\\\"");
            //   // return false;
            //});
            //function f_SaveBefore() {
            //    //保存前处理(字段格式:int类型不能为空,日期类型符合格式,bool类型)
            //    if ($("#HInterID").val() == '') {
@@ -690,7 +701,8 @@
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
           });
        });
    </script>
</body>
</html>