duhe
2025-09-01 e57b2edbffff5a653ba9eda65eae100ceb2e7822
WebTM/views/²É¹º¹ÜÀí/²É¹º¶©µ¥/Cg_POOrderBillQuery.html
@@ -18,6 +18,7 @@
    <script src="../../../layuiadmin/HideButton.js"></script>
    <script src="../../../layuiadmin/soulTable.slim.js"></script>
    <script src="../../../layuiadmin/PageTitle.js"></script>
    <script src="../../../layuiadmin/layui-common-custom.js"></script>
    <style type="text/css">
        .layui-table-click {
            background: #ceedfa;
@@ -94,6 +95,8 @@
                                            </div>
                                        </div>
                                        <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnResCnz" id="btnReSearch" style="padding:0 5px">重新同步</button>
                                        <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnResCnzManual" id="btnResCnzManual" style="padding:0 5px">手工同步</button>
                                    </div>
                                    <div class="layui-inline">
                                        <div class="layui-row" style="margin-top:5px">
@@ -210,7 +213,7 @@
                                <button type="button" class="layui-btn layui-btn-sm" style="display:none;" lay-event="set_ReadScheme" id="set_ReadScheme"><i class="layui-icon layui-icon-set"></i>读取方案</button>
                            </div>
                        </script>
                        <table class="" id="mainTableSub" lay-filter="mainTableSub"></table>
                        <table class="" id="mainTableSub" lay-filter="mainTableSub" style="margin-top:35px"></table>
                        <script type="text/html" id="toolbarDemoSub">
                            <div class="layui-btn-container">
                                <button type="button" class="layui-btn layui-btn-sm" style="display:none;" lay-event="set_CloseRow" id="set_CloseRow"><i class="layui-icon layui-icon-form"></i>行关闭</button>
@@ -291,8 +294,8 @@
                    case 'btn-Delete': set_DeleteBill();
                        break;
                    //浏览
                    case 'btn-view': get_ViewReport();
                        break;
                    //case 'btn-view': get_ViewReport();
                    //    break;
                    //打印
                    case 'btn-print': get_PrintReport();
                        break;
@@ -383,6 +386,11 @@
                set_ClearQuery();
            });
            //手工同步按钮
            form.on('submit(btnResCnzManual)', function (data) {
                get_ResCnzManual(layer, HBillType, get_FastQuery)
            })
            table.on('tool(mainTable)' , function (obj) {
                var data = obj.data;
                if (obj.event == '单据号') {
@@ -452,7 +460,7 @@
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                //初始化表格
                set_InitGrid();
                //直接执行列表筛选 åŠ è½½æ•°æ®åˆ°ç½‘æ ¼
                ////直接执行列表筛选 åŠ è½½æ•°æ®åˆ°ç½‘æ ¼
                get_FastQuery(table, option,1)
                //查询当前登录用户有没有在当前模块设置默认过滤方案
@@ -463,108 +471,13 @@
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , height: 'full-330'
                    , height: 'full-300'
                    , page: true
                    , totalRow: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
                    , cols: [[
                        { type: 'checkbox', fixed: 'left', totalRowText: '合计' }
                        ,{ field: 'hmainid', title: 'hmainid', sort: true, hide: true }
                        , { field: '日期', title: '日期', width: 120, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '单据号', title: '单据号', width: 150, }
                        , { field: '状态', title: '状态', width: 100, sort: true }
                        , { field: 'HBillType', title: 'HBillType', hide: true, sort: true }
                        , { field: '行状态', title: '行状态', width: 125, sort: true }
                        , { field: '供应商', title: '供应商', width: 150 }
                        , { field: '业务员', title: '业务员', width: 100 }
                        //, { field: 'HBillType', title: 'HBillType', hide: true }
                        //, { field: 'HSupID', title: 'HSupID', hide: true }
                        //, { field: '业务状态', title: '业务状态', width: 100, hide: true }
                        , { field: '分配状态', title: '分配状态', width: 100 }
                        , { field: '发布状态', title: '发布状态', width: 100 }
                        , { field: '供应商协同状态', title: '供应商协同状态', width: 135 }/*物料代码,物料名称,规格型号,批号,数量,单位,源单单号*/
                        , { field: '反馈状态', title: '供应商反馈状态', width: 135 }
                        , { field: '物料编码', title: '物料编码', width: 120 }
                        , { field: '物料代码', title: '物料代码', width: 130 }
                        , { field: '旧物料编码', title: '旧物料编码', width: 130 }
                        , { field: '物料名称', title: '物料名称', width: 130 }
                        , { field: '数量', title: '订单数量', width: 100, totalRow: true }
                        , { field: '打印条码数量', title: '打印条码数量', width: 120, totalRow: true  }
                        /* å®‰ç‘žæ–°å¢žå­—段 begin */
                        , { field: '可打印条码数量', title: '可打印条码数量', width: 120, totalRow: true}
                        /* å®‰ç‘žæ–°å¢žå­—段 end */
                        , { field: '关联数量', title: '已发货数量', width: 120, totalRow: true}
                        , { field: '未关联数量', title: '可发货数量', width: 120, totalRow: true}
                        /* å®‰ç‘žæ–°å¢žå­—段 begin */
                        , { field: '退料数量', title: '退料数量', width: 120, totalRow: true}
                        , { field: '实收数量', title: '实收数量', width: 120, totalRow: true}
                        , { field: '入库数量', title: '入库数量', width: 120, totalRow: true}
                        , { field: '剩余入库数量', title: '剩余入库数量', width: 120, totalRow: true}
                        , { field: '剩余收料数量', title: '剩余收料数量', width: 120, totalRow: true}
                        /* å®‰ç‘žæ–°å¢žå­—段 end */
                        , { field: '完成状态', title: '完成状态', width: 100 }
                        , { field: 'HUnitID', title: 'HUnitID', hide: true }
                        , { field: '规格型号', title: '规格型号', width: 100 }
                        //, { field: 'HUnitID', title: 'HUnitID', hide: true }  é‡å¤
                        , { field: '计量单位代码', title: '计量单位代码', width: 120 , hide: true }
                        , { field: '计量单位', title: '计量单位', width: 100 }
                        , { field: '批号', title: '批号', width: 100 }
                        , { field: '数量', title: '数量', width: 100, totalRow: true }
                        , { field: '源单单号', title: '源单单号', width: 100 }
                        //, { field: '供应商代码', title: '供应商代码', width: 120, hide: true}
                        //, { field: '业务员代码', title: '业务员代码', width: 100, hide: true}
                        //, { field: 'HPriority', title: 'HPriority', width: 100, hide: true }
                        , { field: '优先级', title: '优先级', width: 100 }
                        , { field: '交货地点', title: '交货地点', width: 100}
                        , { field: 'HPSStyleID', title: 'HPSStyleID', hide: true }
                        , { field: '采购方式代码', title: '采购方式代码', width: 120, hide: true }
                        , { field: '采购方式', title: '采购方式', width: 100}
                        , { field: 'HSSID', title: 'HSSID', hide: true }
                        , { field: '结算方式代码', title: '结算方式代码', width: 120}
                        , { field: '结算方式', title: '结算方式', width: 100}
                        , { field: '结算日期', title: '结算日期', width: 120, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.结算日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: 'HCurID', title: 'HCurID', hide: true }
                        , { field: '币别代码', title: '币别代码', width: 100, hide: true }
                        , { field: '币别', title: '币别', width: 100}
                        , { field: '汇率', title: '汇率', width: 100}
                        , { field: 'HDeptID', title: 'HDeptID', hide: true }
                        , { field: '部门代码', title: '部门代码', width: 100, hide: true }
                        , { field: '部门', title: '部门', width: 100}
                        , { field: 'HManagerID', title: 'HManagerID', hide: true }
                        , { field: '主管代码', title: '主管代码', width: 100, hide: true }
                        , { field: '主管', title: '主管', width: 100}
                        , { field: 'HEmpID', title: 'HEmpID', hide: true }
                        , { field: '摘要', title: '摘要', width: 100 }
                        , { field: 'HWHID', title: '主表仓库ID', width: 120, hide: true}
                        , { field: '仓库', title: '主表仓库', width: 100, hide: true}
                        , { field: '表头备注', title: '表头备注', width: 100}
                        , { field: 'hsubid', title: 'hsubid', hide: true }
                        , { field: 'HMaterID', title: 'HMaterID', hide: true }
                        , { field: '单价', title: '单价', width: 100}
                        , { field: '金额', title: '金额', width: 100, totalRow: true }
                        , { field: '税率', title: '税率', width: 100}
                        , { field: '税额', title: '税额', width: 100}
                        , { field: '折扣率', title: '折扣率', width: 100}
                        , { field: '价税合计', title: '价税合计', width: 100}
                        , { field: '交货日期', title: '交货日期', width: 120, templet: "<div>{{d.交货日期 ==null ?'':layui.util.toDateString(d.交货日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '计划跟踪号', title: '计划跟踪号', width: 100}
                        , { field: '表体备注', title: '表体备注', width: 100}
                        , { field: '制单人', title: '制单人', width: 100}
                        , { field: '制单日期', title: '制单日期', width: 200, templet: "<div>{{d.制单日期 ==null ?'':layui.util.toDateString(d.制单日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                        , { field: '审核人', title: '审核人', width: 100}
                        , { field: '审核日期', title: '审核日期', width: 120, templet: "<div>{{d.审核日期 ==null ?'':layui.util.toDateString(d.审核日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                        , { field: '修改人', title: '修改人', width: 100}
                        , { field: '修改日期', title: '修改日期', width: 120, templet: "<div>{{d.修改日期 ==null ?'':layui.util.toDateString(d.修改日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                        , { field: '关闭人', title: '关闭人', width: 100}
                        , { field: '关闭日期', title: '关闭日期', width: 120, templet: "<div>{{d.关闭日期 ==null ?'':layui.util.toDateString(d.关闭日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                        , { field: '行关闭人', title: '行关闭人', width: 125, sort: true }
                       , { field: '行关闭日期', title: '行关闭日期', width: 200, templet: "<div>{{d.行关闭人 == ''?'':layui.util.toDateString(d.行关闭日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
                        , { field: '作废人', title: '作废人', width: 100}
                        , { field: '作废日期', title: '作废日期', width: 120, templet: "<div>{{d.作废日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                ]]
                    , cols: [[]]
                    , done: function (res, curr, count) {
                        soulTable.render(this);
@@ -574,8 +487,8 @@
                optionSub = {
                    elem: '#mainTableSub'
                    , toolbar: '#toolbarDemoSub'
                    , height: 'full-500'
                    , page: true
                    //, height: 'full-500'
                    , page: false
                    , totalRow: true
                    , cellMinWidth: 90
                    , limit: 50
@@ -593,6 +506,7 @@
                $.ajax({
                    url: GetWEBURL() + '/Cg_POOrderBill/QueryList',
                    type: "GET",
                    async: false,
                    data: { "sWhere": sWhere  , "user": sessionStorage["HUserName"]},
                    success: function (data1) {
                        if (data1.count == 1) {
@@ -611,7 +525,7 @@
                                }
                            }
                            //在列表左边添加勾选框
                            col.push({ type: 'radio', fixed: 'left', totalRowText: '合计'});
                            col.push({ type: 'checkbox', fixed: 'left', totalRowText: '合计'});
                            for (var i = 0; i < data.length; i++) {
                                // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
                                if ($.inArray(data[i].name, titleData) > -1) {
@@ -635,7 +549,7 @@
                                    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=="行关闭日期"?"行关闭人":data[i].name) + " ==''?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 200 });
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{layui.util.toDateString(d." + (data[i].name != "日期" ? data[i].name + ", 'yyyy-MM-dd HH:mm:ss'" : data[i].name +", 'yyyy-MM-dd'")+")}}</div>", width: 200 });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
@@ -800,7 +714,7 @@
                    //逻辑删除方法
                    layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                        if (data[0].状态 == "创建") {
                        /*if (data[0].状态 == "创建") {*/
                            $.ajax({
                                type: "GET",
                                url: GetWEBURL() + "/Cg_POOrderBill/DeltetCg_POOrderBill", //方法所在页面和方法名
@@ -825,10 +739,10 @@
                                    layer.alert("接口请求失败!", { icon: 5 });
                                }
                            });
                        } else {
                            layer.msg('该条数据不是创建状态,无法删除!');
                        //} else {
                        //    layer.msg('该条数据不是创建状态,无法删除!');
                        }
                        //}
                    })
                }
@@ -847,10 +761,7 @@
                }
                else {
                    var hmainid = [];
                    for (var i = 0; i < checkStatus.data.length; i++) {
                        hmainid.push((data[i].hmainid * (10 ** 8)) + data[i].hsubid)
                    }
                    var hmainid = data[0].hmainid.toString();
                    layer.open({
                        type: 2
@@ -859,7 +770,7 @@
                        , shade: 0.6 //遮罩透明度
                        , maxmin: false //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + hmainid.toString() + '&MyMsg=' + hmainid.toString() + '&Type=HPOOrderBill', 'yes']
                        , content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + hmainid.toString() + '&MyMsg=' + hmainid.toString() + '&Type=HPOOrderBillByID', 'yes']
                        , resize: false
                    })
                }
@@ -1279,15 +1190,10 @@
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd")); //开始日期
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));  //结束日期
                $('#HStatus').find("option[value='-1']").attr("selected", true);
                $("#HBillNo").val("");
                $("#HEmpName").val("");
                $("#HMaterNumber").val("");
                $("#HOldMaterNumber").val("");
                $("#HMaterShortNumber").val("");
                $("#HMaterName").val("");
                $("#HSupName").val("");
                $("#HOrgID").val(sessionStorage["OrganizationID"]);
                /*$("#HOrgID").val(sessionStorage["OrganizationID"]);*/
                $("#ColContent").val("");
                $("#ColName").val("0");
                $("#Comparator").val("0");
@@ -1332,7 +1238,6 @@
                    }
                });
            }
            //#endregion
            //刷新
            function set_Refresh() {
@@ -1416,6 +1321,10 @@
                                //设置表格title属性显示别名
                                if (dataCols[4] != null && dataCols[4] != "") {
                                    option.cols[0][i + 1]["title"] = dataCols[4];
                                }
                                //统计列
                                if (dataCols[6] == 1) {
                                    option.cols[0][i + 1]["totalRow"] = true;
                                }
                            }
@@ -1534,7 +1443,10 @@
                                if (dataCols[4] != null && dataCols[4] != "") {
                                    optionSub.cols[0][i + 1]["title"] = dataCols[4];
                                }
                                //统计列
                                if (dataCols[6] == 1) {
                                    optionSub.cols[0][i + 1]["totalRow"] = true;
                                }
                            }
                            //取消冻结列
@@ -1576,15 +1488,26 @@
            //#region è¡Œç‚¹å‡»äº‹ä»¶
            table.on('row(mainTable)', function (obj) {
                //选中行改变颜色
                var flag = !obj.tr.find(':checkbox:first').prop('checked');
                obj.tr.find(':checkbox').prop('checked', flag);
                if (flag) {
                    obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked');  //设置复选框选中样式
                    $(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" });//改变当前tr背景颜色和字体颜色
                } else {
                    obj.tr.find('.layui-form-checkbox').removeClass('layui-form-checked');//取消复选框选中样式
                    $(obj.tr.selector).attr({ "style": "background:" });//取消当前tr颜色
                }
                //mainTable ä¸ºè¡¨æ ¼ID   æ³¨æ„æ­¤å¤„如果ID不正确将导致你在监听复选框时获取不到你选择的数据,前面的只是添加或删除选中未选中样式以及设置背景色,字体颜色
                layui.each(table.cache.mainTable, function (i, l) {
                    if (obj.tr.index() == l.LAY_TABLE_INDEX) {
                        l.LAY_CHECKED = flag;
                    }
                });
                //显示子表
                get_DisplaySub(obj.data);
                //判断是否已经被选中
                if (obj.tr.find('.layui-form-radioed').length == 0) {
                    //触发单选框选中事件
                    obj.tr.find('i[class="layui-anim layui-icon"]').trigger("click");
                }
            })
            //子表单选
            table.on('row(mainTableSub)', function (obj) {
@@ -1596,6 +1519,22 @@
            })
            //#endregion
            //#region æŽ’序后选择
            table.on('sort(mainTable)', function (obj) { //注:sort æ˜¯å·¥å…·æ¡äº‹ä»¶åï¼Œtest æ˜¯ table åŽŸå§‹å®¹å™¨çš„å±žæ€§ lay-filter="对应的值"
                table.reload('mainTable', {
                    initSort: obj //记录初始排序,如果不设的话,将无法标记表头的排序状态。 layui 2.1.1 æ–°å¢žå‚æ•°
                    , where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
                        field: obj.field //排序字段   åœ¨æŽ¥å£ä½œä¸ºå‚数字段  field order
                        , order: obj.type //排序方式   åœ¨æŽ¥å£ä½œä¸ºå‚数字段  field order
                    }
                });
                option.data = layui.table.cache["mainTable"];
                table.render(option);
                //刷新按钮显示
                var btns = document.getElementsByTagName("button");     //获取本页所有按钮对象
                Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
            });
            //#endregion
            //#region åˆå§‹æ—¥æœŸé—´éš” ä¸‹æ‹‰åˆ—表
            function setSelect_HInitTimeCycle() {
@@ -1691,7 +1630,7 @@
                            //隐藏显示过滤方案的标签信息
                            document.getElementById("HFilterScheme_Now").style.display = "none";
                            ////执行查询方法
                            //get_FastQuery()
                            get_FastQuery()
                            //form.render("select");
                        }
                    }, error: function () {
@@ -1885,7 +1824,7 @@
                var addSWhere = "";
                if (openType == 2) {
                    addSWhere = " and çŠ¶æ€ = '已审核' and è¡ŒçŠ¶æ€ = '' and HOrgID = " + HOrgID;
                    addSWhere = " and å®¡æ ¸äºº! = '' and å…³é—­äºº = ''";
                }
                return addSWhere;
            }