yangle
2022-09-07 d9ccb1dfdb438225014b0b95d642a4e2a0c3736b
WebTM/views/Éú²ú¹ÜÀí/Éú²úÈÎÎñµ¥/Sc_ICMOBillList.html
@@ -50,6 +50,16 @@
                                </button>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
                                <div class="layui-inline">
                                    <label class="layui-form-label">单据号</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="HBillno2" id="HBillno2" style="width:190px;">
                                    </div>
                                </div>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnResCnz" id="btnReSearch" style="padding:0 5px">重新同步</button>
                                <div class="layui-colla-content">
                                    <div class="layui-inline">
                                        <div class="layui-inline">
@@ -57,9 +67,40 @@
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">单据号</label>
                                        <label class="layui-form-label">生产车间</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="WorkCenter" id="WorkCenter">
                                            <select name="HDeptName" id="HDeptName" lay-verify="required" lay-search class="layui-input">
                                                <!--动态渲染车间-->
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">业务状态</label>
                                        <div class="layui-input-block">
                                            <select name="HStatus" id="HStatus" lay-verify="required" lay-search class="layui-input">
                                                <option value="0" selected>全部</option>
                                                <option value="计划">计划</option>
                                                <option value="计划确认">计划确认</option>
                                                <option value="下达">下达</option>
                                                <option value="开工">开工</option>
                                                <option value="完工">完工</option>
                                                <option value="结案">结案</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">单据类型</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HBillType" id="HBillType">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">物料编码</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HMaterName" id="HMaterName">
                                        </div>
                                    </div>
                                </div>
@@ -71,6 +112,8 @@
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_ShowBill"><i class="layui-icon layui-icon-form"></i>下推</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_DeleteBill"><i class="layui-icon layui-icon-delete"></i>删除</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Refresh"><i class="layui-icon layui-icon-refresh-3"></i>刷新</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get-view"><i class="layui-icon layui-icon-tips"></i>预览</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get-print"><i class="layui-icon layui-icon-print"></i>打印</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Exit"><i class="layui-icon layui-icon-logout"></i>退出</button>
                            </div>
                        </script>
@@ -105,7 +148,27 @@
            //初始化界面
            set_ClearBill();
            //获取车间列
            var HDeptName = '<option value="0" style="color:red;" selected>全部车间</option>';
            $.ajax({
                type: "get",
                url: GetWEBURL() + "/Sc_ICMOBill/GetHDeptList",
                success: function (result) {
                    if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                        var data = result.data;
                        for (var i = 0; i < data.length; i++) {
                            if (i == 0)
                                HDeptName += '<option  style="color:blue;"  value="' + data[i].HItemID + '" >' + data[i].HName + '</option>';
                            else
                                HDeptName += '<option  style="color:blue;" value="' + data[i].HItemID + '">' + data[i].HName + '</option>';
                        }
                        $("#HDeptName").append(HDeptName);
                        form.render('select');
                    }
                    layer.closeAll("loading");
                }
            })
            //#endregion
@@ -118,13 +181,26 @@
                    //删除
                    case 'set_DeleteBill': set_DeleteBill();
                        break;
                    case 'get-view': get_ViewReport();
                        break;
                    case 'get-print': get_PrintReport();
                        break;
                    //刷新
                    case 'get_Refresh': get_Refresh();
                        break;
                    //退出按钮
                    case 'get_Exit': Pub_Close(2);
                        break;
                    //打印
                    case 'btn-print':
                        get_PrintReport();
                        break;
                };
            });
            //重新同步按钮
            form.on('submit(btnResCnz)', function (data) {
                set_ResCnz();
            });
            //重置按钮
@@ -149,6 +225,87 @@
            //#endregion
            option_YQN = {
                elem: '#mainTable'
                , toolbar: '#toolbarDemo'
                , height: 'full-50'
                , page: true
                , cellMinWidth: 90
                , limit: 50
                , limits: [50, 500, 5000, 20000]
                , cols: [[
                    { type: 'checkbox', fixed: 'left' }
                    , { field: 'hmainid', title: 'hmainid', sort: true, width: 165, hide: true }
                    , { field: 'HEntryID', title: 'HEntryID', sort: true, width: 165, hide: true }
                    , { field: '日期', title: '日期', sort: true, width: 120, hide: true }
                    , { field: '销售订单日期', title: '销售订单日期', sort: true, width: 120, hide: true }
                    , { field: '单据号', title: '单据号', sort: true, width: 170, hide: true }
                    , { field: '销售订单日期', title: '销售订单日期', sort: true, width: 200 }
                    , { field: '销售订单编号', title: '销售订单编号', sort: true, width: 200 }
                    , { field: '销售物料名称', title: '销售物料名称', sort: true, width: 200 }
                    , { field: '包装方式', title: '包装方式', sort: true, width: 150 }
                    , { field: '销售数量', title: '销售数量', sort: true, width: 150 }
                    , { field: '销售订单联系人', title: '销售订单联系人', sort: true, width: 150 }
                    , { field: '业务状态', title: '业务状态', sort: true, width: 150 }
                    , { field: '订单跟踪号', title: '订单跟踪号', sort: true, width: 120, hide: true }
                    , { field: 'HDeptID', title: 'HDeptID', hide: true }
                    , { field: '生产车间代码', title: '生产车间代码', width: 115, hide: true }
                    , { field: '生产车间', title: '生产车间', width: 115, hide: true }
                    , { field: 'HMaterID', title: 'HMaterID', hide: true }
                    , { field: '产品代码', title: '产品代码', width: 160, hide: true }
                    , { field: '产品名称', title: '产品名称', width: 160, hide: true }
                    , { field: '规格型号', title: '规格型号', width: 215, hide: true }
                    , { field: 'hunitid', title: 'hunitid', hide: true }
                    , { field: '计量单位代码', title: '计量单位代码', width: 115, hide: true }
                    , { field: '计量单位', title: '计量单位', hide: true }
                    , { field: 'hempid', title: 'hempid', hide: true }
                    , { field: '业务员代码', title: '业务员代码', width: 100, hide: true }
                    , { field: '业务员', title: '业务员', hide: true }
                    , { field: 'hcusid', title: 'hcusid', hide: true }
                    , { field: '客户代码', title: '客户代码', hide: true }
                    , { field: '客户', title: '客户', hide: true }
                    , { field: 'HCenterID', title: 'HCenterID', hide: true }
                    , { field: '工作中心代码', title: '工作中心代码', hide: true }
                    , { field: '工作中心', title: '工作中心', hide: true }
                    , { field: 'hbomid', title: 'hbomid', hide: true }
                    , { field: 'BOM单编码', title: 'BOM单编码', hide: true }
                    , { field: 'HRoutingInterID', title: 'HRoutingInterID', hide: true }
                    , { field: '工艺路线代码', title: '工艺路线代码', hide: true }
                    , { field: '工艺路线', title: '工艺路线', hide: true }
                    , { field: '计划开工日期', title: '计划开工日期', hide: true }
                    , { field: '计划完工日期', title: '计划完工日期', hide: true }
                    , { field: '最迟开工日期', title: '最迟开工日期', hide: true }
                    , { field: '最迟完工日期', title: '最迟完工日期', hide: true }
                    , { field: '齐套数量', title: '齐套数量', hide: true }
                    , { field: '计划生产数量', title: '计划生产数量', hide: true }
                    , { field: '关联数量', title: '关联数量', hide: true }
                    , { field: '未关联数量', title: '未关联数量', hide: true }
                    , { field: '表头备注', title: '表头备注', hide: true }
                    , { field: 'hsubid', title: 'hsubid', hide: true }
                    , { field: '源单单号', title: '源单单号', hide: true }
                    , { field: '源单主内码', title: '源单主内码', hide: true }
                    , { field: '源单子内码', title: '源单子内码', hide: true }
                    , { field: '制单人', title: '制单人', hide: true }
                    , { field: '制单日期', title: '制单日期', hide: true }
                    , { field: '审核人', title: '审核人', hide: true }
                    , { field: '审核日期', title: '审核日期', hide: true }
                    , { field: '修改人', title: '修改人', hide: true }
                    , { field: '修改日期', title: '修改日期', hide: true }
                    , { field: '关闭人', title: '关闭人', hide: true }
                    , { field: '关闭日期', title: '关闭日期', hide: true }
                    , { field: '作废人', title: '作废人', hide: true }
                    , { field: '作废日期', title: '作废日期', hide: true }
                    , { field: '行关闭人', title: '行关闭人', hide: true }
                    , { field: '关闭类型', title: '关闭类型', hide: true }
                    , { field: '单据类型', title: '单据类型', hide: true }
                    , { field: '计划跟踪号', title: '计划跟踪号', hide: true }
                ]]
            };
            function set_InitGrid() {
                $("#HDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
                $("#HDate1").val(Format(new Date(), "yyyy-MM-dd"));
@@ -162,34 +319,18 @@
                    , limits: [50, 500, 5000, 20000]
                    , cols: [[
                        { type: 'checkbox', fixed: 'left' }
                        //{ field: 'hmainid', title: 'hmainid', sort: true, width: 165 }
                        , { field: '日期', title: '日期', sort: true, width: 120 }
                        , { field: 'hmainid', title: 'hmainid', sort: true, width: 165, hide: true }
                        , { field: 'HEntryID', title: 'HEntryID', sort: true, width: 165, hide: true }
                        , { field: '单据号', title: '单据号', sort: true, width: 170 }
                        , { field: '订单跟踪号', title: '订单跟踪号', width: 105 }
                        //, { field: 'HDeptID', title: 'HDeptID' }
                        , { field: '生产车间代码', title: '生产车间代码', width: 115 }
                        , { field: '生产车间', title: '生产车间', width: 115 }
                        //, { field: 'HMaterID', title: 'HMaterID' }
                        , { field: '日期', title: '日期' }
                        , { field: '产品代码', title: '产品代码', width: 160 }
                        , { field: '产品名称', title: '产品名称', width: 160 }
                        , { field: '规格型号', title: '规格型号', width: 215 }
                        //, { field: 'hunitid', title: 'hunitid' }
                        , { field: '生产车间代码', title: '生产车间代码', width: 115 }
                        , { field: '生产车间', title: '生产车间', width: 115 }
                        , { field: '生产任务单数量', title: '生产订单数量', width: 115 }
                        , { field: '计量单位代码', title: '计量单位代码', width: 115 }
                        , { field: '计量单位', title: '计量单位' }
                        //, { field: 'hempid', title: 'hempid' }
                        , { field: '业务员代码', title: '业务员代码', width: 100 }
                        , { field: '业务员', title: '业务员' }
                        , { field: 'hcusid', title: 'hcusid' }
                        , { field: '客户代码', title: '客户代码' }
                        , { field: '客户', title: '客户' }
                        //, { field: 'HCenterID', title: 'HCenterID' }
                        , { field: '工作中心代码', title: '工作中心代码' }
                        , { field: '工作中心', title: '工作中心' }
                        //, { field: 'hbomid', title: 'hbomid' }
                        , { field: 'BOM单编码', title: 'BOM单编码' }
                        //, { field: 'HRoutingInterID', title: 'HRoutingInterID' }
                        , { field: '工艺路线代码', title: '工艺路线代码' }
                        , { field: '工艺路线', title: '工艺路线' }
                        , { field: '计划开工日期', title: '计划开工日期' }
                        , { field: '计划完工日期', title: '计划完工日期' }
                        , { field: '最迟开工日期', title: '最迟开工日期' }
@@ -199,10 +340,6 @@
                        , { field: '关联数量', title: '关联数量' }
                        , { field: '未关联数量', title: '未关联数量' }
                        , { field: '表头备注', title: '表头备注' }
                        //, { field: 'hsubid', title: 'hsubid' }
                        , { field: '源单单号', title: '源单单号' }
                        , { field: '源单主内码', title: '源单主内码' }
                        , { field: '源单子内码', title: '源单子内码' }
                        , { field: '制单人', title: '制单人' }
                        , { field: '制单日期', title: '制单日期' }
                        , { field: '审核人', title: '审核人' }
@@ -211,12 +348,43 @@
                        , { field: '修改日期', title: '修改日期' }
                        , { field: '关闭人', title: '关闭人' }
                        , { field: '关闭日期', title: '关闭日期' }
                        , { field: '作废人', title: '作废人' }
                        , { field: '作废日期', title: '作废日期' }
                        , { field: '行关闭人', title: '行关闭人' }
                        , { field: '关闭类型', title: '关闭类型' }
                        , { field: '单据类型', title: '单据类型' }
                        , { field: '计划跟踪号', title: '计划跟踪号' }
                        , { field: '作废人', title: '作废人', hide: true }
                        , { field: '作废日期', title: '作废日期', hide: true }
                        , { field: '销售订单日期', title: '销售订单日期', sort: true, width: 120, hide: true }
                        , { field: '销售订单日期', title: '销售订单日期', sort: true, width: 200 }
                        , { field: '销售订单编号', title: '销售订单编号', sort: true, width: 200 }
                        , { field: '销售物料名称', title: '销售物料名称', sort: true, width: 200 }
                        , { field: '包装方式', title: '包装方式', sort: true, width: 150 }
                        , { field: '销售数量', title: '销售数量', sort: true, width: 150 }
                        , { field: '销售订单联系人', title: '销售订单联系人', sort: true, width: 150 }
                        , { field: '业务状态', title: '业务状态', sort: true, width: 150 }
                        , { field: '订单跟踪号', title: '订单跟踪号', sort: true, width: 120, hide: true }
                        , { field: 'HDeptID', title: 'HDeptID', hide: true}
                        , { field: 'HMaterID', title: 'HMaterID', hide: true }
                        , { field: 'hunitid', title: 'hunitid', hide: true }
                        , { field: 'hempid', title: 'hempid' , hide: true}
                        , { field: '业务员代码', title: '业务员代码', width: 100, hide: true}
                        , { field: '业务员', title: '业务员', hide: true}
                        , { field: 'hcusid', title: 'hcusid', hide: true }
                        , { field: '客户代码', title: '客户代码', hide: true }
                        , { field: '客户', title: '客户', hide: true }
                        , { field: 'HCenterID', title: 'HCenterID' , hide: true}
                        , { field: '工作中心代码', title: '工作中心代码', hide: true}
                        , { field: '工作中心', title: '工作中心', hide: true}
                        , { field: 'hbomid', title: 'hbomid' , hide: true}
                        , { field: 'BOM单编码', title: 'BOM单编码', hide: true }
                        , { field: 'HRoutingInterID', title: 'HRoutingInterID' , hide: true}
                        , { field: '工艺路线代码', title: '工艺路线代码', hide: true }
                        , { field: '工艺路线', title: '工艺路线', hide: true}
                        , { field: 'hsubid', title: 'hsubid' , hide: true}
                        , { field: '源单单号', title: '源单单号', hide: true}
                        , { field: '源单主内码', title: '源单主内码', hide: true}
                        , { field: '源单子内码', title: '源单子内码', hide: true}
                        , { field: '行关闭人', title: '行关闭人', hide: true}
                        , { field: '关闭类型', title: '关闭类型', hide: true}
                        , { field: '单据类型', title: '单据类型', hide: true}
                        , { field: '计划跟踪号', title: '计划跟踪号', hide: true}
                    ]]
                };
            }
@@ -250,10 +418,14 @@
            //#region å¿«é€Ÿè¿‡æ»¤
            function get_FastQuery() {
                var HDate = $("#HDate").val();//开始日期
                var HDate =  $("#HDate").val();;//开始日期
                var HDate1 = $("#HDate1").val();//结束日期
                var HOrderProcNO = $("#HOrderProcNO").val();//订单跟踪号
                var WorkCenter = $("#WorkCenter").val();//单据号
                var HMaterName = $("#HMaterName").val();//单据号
                var HDeptName = $("#HDeptName").val();//单据号
                var HStatus = $("#HStatus").val();//单据号
                var HBillType = $("#HBillType").val();//单据类型
                if (HDate) {
                    sWhere += " and æ—¥æœŸ >= '" + HDate + "'";
                }
@@ -266,6 +438,18 @@
                if (WorkCenter) {
                    sWhere += " and å•据号 like '%" + WorkCenter + "%'";
                }
                if (HMaterName) {
                    sWhere += " and äº§å“ä»£ç  like '%" + HMaterName + "%'";
                }
                if (HDeptName && HDeptName!=0) {
                    sWhere += " and HDeptID = " + HDeptName ;
                }
                if (HStatus && HStatus != 0) {
                    sWhere += " and ä¸šåŠ¡çŠ¶æ€  like '%" + HStatus + "%'";
                }
                if (HBillType) {
                    sWhere += " and å•据类型 like '%" + HBillType + "%'";
                }
                get_Display(sWhere);
                sWhere = "";//调用接口后清空sWhere缓存
            }
@@ -273,10 +457,14 @@
            //#region é‡ç½®è¿‡æ»¤æ¡ä»¶æ–¹æ³•
            function set_ClearQuery() {
                $("#HDate").val("");//开始日期
                $("#HDate1").val("");//结束日期
                $("#HDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));//开始日期
                $("#HDate1").val(Format(new Date(), "yyyy-MM-dd"));;//结束日期
                $("#HOrderProcNO").val("");//订单跟踪号
                $("#WorkCenter").val("");//单据号
                $("#HDeptName").val("");//单据号
                $("#HMaterName").val("");//单据号
                $("#HDeptName").val("");//单据号
                $("#HStatus").val("");//单据号
                $("#btnSearch").click();
                sWhere = "";
            }
@@ -308,12 +496,13 @@
                    , data = checkStatus.data;
                if (data.length === 1) {
                    var linterid = data[0].hmainid.toString();
                    var HEntryID = data[0].HEntryID.toString();
                    layer.open({
                        type: 2
                        , area: ['100%', '100%']
                        , title: '工序流转卡-编辑'
                        , shift: 0//弹出动画
                        , content: '../../车间管理/工序流转卡/Sc_ProcessExchangeBill.html?OperationType=2&linterid=' + linterid + '&HSouceBillType=3772'
                        , content: '../../车间管理/工序流转卡/Sc_ProcessExchangeBill.html?OperationType=2&linterid=' + linterid + '&HEntryID=' + HEntryID+'&HSouceBillType=3772'
                    })
                } else {
                    layer.msg('请选择一行数据下推!');
@@ -360,12 +549,36 @@
            }
            //#endregion
            //laydate.render({
            //    elem: '#HDate'
            //    , type: 'datetime'
            //    , trigger: 'click'
            //    , format:'yyyy-MM-dd HH:mm'
            //});
            //重新同步按钮
            function set_ResCnz() {
                var HBillno2 = $('#HBillno2').val();
                $.ajax({
                    url: GetWEBURL() + '/Cg_POOrderBill/Resynchronize',
                    type: "GET",
                    data: { "HBillNo": HBillno2, "HBillType": 3710 },
                    success: function (result) {
                        if (result.count == 1) {
                            layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                // å¾—到frame索引
                                var index = layer.getFrameIndex(window.name);
                                //关闭当前frame
                                layer.close(index);
                                //修改为功后刷新界面
                                window.location.reload();
                            });
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(wait);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
            //#region åˆ·æ–°
            function get_Refresh() {
                set_ClearQuery();
@@ -373,11 +586,63 @@
            }
            //#endregion
            //#region æ‰“印
            //预览
            function get_ViewReport() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                var PrintIds = "";
                if (checkStatus.data.length >= 1) {
                    for (var i = 0; i < data.length; i++) {
                        PrintIds += data[i].hmainid+"0"+data[i].HEntryID + ","
                    }
                    PrintIds = PrintIds.substring(0, PrintIds.length - 1);
                    layer.open({
                        type: 2
                        , area: ['50%', '50%']
                        , title: '打印模版选择'
                        , shade: 0.6 //遮罩透明度
                        , maxmin: false //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + PrintIds + '&MyMsg=' + data[0].hmainid.toString() + '&Type=HIcmoBill', 'yes']
                        , resize: false
                    })
                }
                else {
                    layer.msg('请选择至少一行数据打印!');
                }
            }
            //打印
            function get_PrintReport() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                var PrintIds = "";
                if (checkStatus.data.length >= 1) {
                    for (var i = 0; i < data.length; i++) {
                        PrintIds += data[i].hmainid + "-" + data[i].HEntryID + ","
                    }
                    PrintIds = PrintIds.substring(0, PrintIds.length - 1);
                    layer.open({
                        type: 2
                        , area: ['50%', '50%']
                        , title: '打印模版选择'
                        , shade: 0.6 //遮罩透明度
                        , maxmin: false //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + PrintIds + '&MyMsg=' + data[0].hmainid.toString() + '&Type=HIcmoBill', 'yes']
                        , resize: false
                    })
                }
                else {
                    layer.msg('请选择至少一行数据打印!');
                }
            }
            //#endregion
            //以上是layui模块
        });
    </script>