杨乐
2022-02-10 5ce69179bf655ea4760c1fcc76b8d4b5e421f3de
WebTM/views/Éú²ú¹¤Ðò¹ÜÀí/¹¤Ðò¼Æ»®µ¥/Sc_ProcessPlanList.html
@@ -265,8 +265,13 @@
                        }
                        break;
                    //审核
                    case 'btn-Audit':
                        set_AuditBill();
                    case 'btn-Audit': set_AuditBill();
                        break;
                    //反审核
                    case 'btn-DeAudit': set_DeAuditBill();
                        break;
                    //删除
                    case 'btn-Delete': set_DeleteBill();
                        break;
                };
            });
@@ -303,14 +308,30 @@
                    , height: 'full-50'
                    , page: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
                    , cols: [[
                        { type: 'checkbox' }
                        //{ field: 'hmainid', title: 'hmainid', sort: true, width: 165 }
                        , { field: 'hmainid', title: 'hmainid', sort: true, fixed: true, hide: true }
                        , { field: '日期', title: '日期', sort: true, width: 120 }
                        , { field: '日期', title: '日期', sort: true, width: 120, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd')}}</div>"}
                        , { field: '单据号', title: '单据号', sort: true, width: 170 }
                        , {
                            field: '单据类型', title: '单据类型', width: 200, templet: function (d) {
                                switch (d.单据类型) {
                                    case 3715:
                                        return "工序计划单"
                                        break;
                                    case 3718:
                                        return "工序返工单"
                                        break;
                                    default:
                                        return d.HBillStatus
                                }
                            }
                        }
                        //, { field: 'HBillStatus ', title: '单据状态', width: 105 }
                        , { field: 'HMaterID', title: 'HMaterID' }
                        , { field: 'HMaterID', title: 'HMaterID', hide: true }
                        ////, { field: 'hunitid', title: 'hunitid' }
                        , { field: '物料代码', title: '物料代码 ', width: 115 }
                        , { field: '物料名称', title: '物料名称' }
@@ -318,61 +339,61 @@
                        , { field: '规格型号', title: '规格型号', width: 100 }
                        , { field: 'HUnitNumber', title: '单位代码' }
                        , { field: '单位', title: '单位' }
                        , { field: 'hunitid', title: 'hunitid' }
                        , { field: 'hunitid', title: 'hunitid', hide: true}
                        , { field: '计量单位代码', title: '计量单位代码' }
                        ////, { field: 'HCenterID', title: 'HCenterID' }
                        , { field: '计量单位', title: '计量单位' }
                        , { field: '生产数量', title: '生产数量' }
                        ////, { field: 'hbomid', title: 'hbomid' }
                        , { field: '计划开工日期', title: '计划开工日期' }
                        , { field: '计划完工日期', title: '计划完工日期' }
                        , { field: '计划开工日期', title: '计划开工日期', templet: "<div>{{d.计划开工日期 ==null ?'':layui.util.toDateString(d.计划开工日期, 'yyyy-MM-dd')}}</div>"}
                        , { field: '计划完工日期', title: '计划完工日期', templet: "<div>{{d.计划完工日期 ==null ?'':layui.util.toDateString(d.计划完工日期, 'yyyy-MM-dd')}}</div>"}
                        , { field: '摘要', title: '摘要' }
                        , { field: '表头备注', title: '表头备注' }
                        , { field: '内部单据号', title: '内部单据号' }
                        , { field: 'hicmointerid', title: 'hicmointerid' }
                        , { field: 'hicmointerid', title: 'hicmointerid', hide: true}
                        , { field: '任务单号', title: '任务单号' }
                        , { field: '制单人', title: '制单人' }
                        , { field: '制单日期', title: '制单日期' }
                        , { field: '制单日期', title: '制单日期', templet: "<div>{{d.制单日期 ==null ?'':layui.util.toDateString(d.制单日期, 'yyyy-MM-dd')}}</div>"}
                        , { field: '审核人', title: '审核人' }
                        , { field: '审核日期', title: '审核日期' }
                        , { field: '审核日期', title: '审核日期', templet: "<div>{{d.审核日期 ==null ?'':layui.util.toDateString(d.审核日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '修改人', title: '修改人' }
                        , { field: '修改日期', title: '修改日期' }
                        , { field: '修改日期', title: '修改日期', templet: "<div>{{d.修改日期 ==null ?'':layui.util.toDateString(d.修改日期, 'yyyy-MM-dd')}}</div>"}
                        , { field: '关闭人', title: '关闭人' }
                        ////, { field: 'hsubid', title: 'hsubid' }
                        , { field: '关闭日期', title: '关闭日期' }
                        , { field: '关闭日期', title: '关闭日期', templet: "<div>{{d.关闭日期 ==null ?'':layui.util.toDateString(d.关闭日期, 'yyyy-MM-dd')}}</div>"}
                        , { field: '关闭类型', title: '关闭类型' }
                        , { field: '作废人', title: '作废人' }
                        , { field: '作废日期', title: '作废日期' }
                        , { field: '作废日期', title: '作废日期', templet: "<div>{{d.作废日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd')}}</div>"}
                        , { field: 'hsubid', title: 'hsubid', fixed: true, hide: true }
                        , { field: '工序计划单号', title: '工序计划单号' }
                        , { field: '工序号', title: '工序号' }
                        , { field: 'hprocid', title: 'hprocid' }
                        , { field: 'hprocid', title: 'hprocid', hide: true}
                        , { field: '工序代码', title: '工序代码' }
                        , { field: '工序', title: '工序' }
                        , { field: '加工说明', title: '加工说明' }
                        , { field: '开工固天', title: '开工固天' }
                        , { field: '开工固数', title: '开工固数' }
                        , { field: 'HCenterID', title: 'HCenterID' }
                        , { field: 'HCenterID', title: 'HCenterID', hide: true}
                        , { field: '工作中心代码', title: '工作中心代码' }
                        , { field: '工作中心', title: '工作中心' }
                        , { field: 'HDeptID', title: 'HDeptID' }
                        , { field: 'HDeptID', title: 'HDeptID', hide: true}
                        , { field: '加工车间代码', title: '加工车间代码' }
                        , { field: '加工车间', title: '加工车间' }
                        , { field: 'HGroupID', title: 'HGroupID' }
                        , { field: 'HGroupID', title: 'HGroupID', hide: true}
                        , { field: '班组代码', title: '班组代码' }
                        , { field: '班组名称', title: '班组名称' }
                        , { field: 'HWorkerID', title: 'HWorkerID' }
                        , { field: 'HWorkerID', title: 'HWorkerID', hide: true}
                        , { field: '操作员代码', title: '操作员代码' }
                        , { field: '操作员', title: '操作员' }
                        , { field: 'HSourceID', title: 'HSourceID' }
                        , { field: 'HSourceID', title: 'HSourceID', hide: true}
                        , { field: '资源代码', title: '资源代码' }
                        , { field: '生产资源', title: '生产资源' }
                        , { field: '计划数量', title: '计划数量' }
                        , { field: '关联数量', title: '关联数量' }
                        , { field: '时间单位', title: '时间单位' }
                        , { field: '计划加工时间', title: '计划加工时间' }
                        , { field: '工序计划开工日期', title: '工序计划开工日期' }
                        , { field: '工序计划完工日期', title: '工序计划完工日期' }
                        , { field: '工序计划开工日期', title: '工序计划开工日期', templet: "<div>{{d.工序计划开工日期 ==null ?'':layui.util.toDateString(d.工序计划开工日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '工序计划完工日期', title: '工序计划完工日期', templet: "<div>{{d.工序计划完工日期 ==null ?'':layui.util.toDateString(d.工序计划完工日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '准备时间', title: '准备时间' }
                        , { field: '排队时间', title: '排队时间' }
                        , { field: '转移时间', title: '转移时间' }
@@ -382,11 +403,10 @@
                        , { field: '源单子内码', title: '源单子内码' }
                        , { field: '源单单号', title: '源单单号' }
                        , { field: '源单类型', title: '源单类型' }
                        , { field: '销售订单主ID', title: '销售订单主ID' }
                        , { field: '销售订单子ID', title: '销售订单子ID' }
                        , { field: '销售订单主ID', title: '销售订单主ID', hide: true}
                        , { field: '销售订单子ID', title: '销售订单子ID', hide: true}
                        , { field: '销售订单号', title: '销售订单号' }
                        , { field: 'HBillType', title: 'HBillType' }
                        , { field: '单据类型', title: '单据类型' }
                        , { field: 'HBillType', title: 'HBillType', hide: true}
                        , { field: 'HBillSubType', title: 'HBillSubType' }
                        , { field: 'HQtyDecimal', title: 'HQtyDecimal' }
                        , { field: 'HPriceDecimal', title: 'HPriceDecimal' }
@@ -403,7 +423,7 @@
                    //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                    url: GetWEBURL() + '/Sc_ProcessMangement/MES_Sc_ProcessPlanMain_Json',
                    type: "GET",
                    data: { "sWhere": sWhere },
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"]},
                    success: function (data1) {
                        if (data1.count == 1) {
                            option.data = data1.data;
@@ -491,42 +511,122 @@
                    return layer.msg("请选择一条数据");
                }
                else {
                    var hmainid = Checkstatus.data[0].hmainid;//获取id
                    var HInterID = Checkstatus.data[0].hmainid;//获取id
                    var HBillStatus = Checkstatus.data[0].HBillStatus;//获取审核状态
                    if (HBillStatus != "1") {
                        return layer.msg("当前单据不为未审核状态!无法法审核");
                        return layer.msg("当前单据不为未审核状态!无法审核");
                    }
                    else {
                        $.ajax({
                            url: GetWEBURL() + "/Sc_ProcessMangement/CheckDeOAuditBill" //方法所在控制器和方法名
                            , type: "GET"
                            , data: { "HInterID": HInterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] }
                            , 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);
                                        //修改为功后刷新界面
                                        set_ClearBill();
                                    });
                                } else {
                                    layer.alert(result.code + result.Message, { icon: 5 });
                                }
                            }, error: function () {
                                layer.alert("接口请求失败!", { icon: 5 });
                            }
                        })
                    }
                }
            }
            //#endregion
            //反审核
            function set_DeAuditBill() {
                var Checkstatus = table.checkStatus("mainTable");
            //监听行工具事件
            //table.on('tool(mainTable)', function(obj){
            //  var data = obj.data;
            //  //console.log(obj)
            //  if(obj.event == 'del'){
            //    layer.confirm('真的删除行么', function(index){
            //      obj.del();
            //      layer.close(index);
            //    });
            //  } else if(obj.event == 'edit'){
            //    layer.prompt({
            //      formType: 2
            //      ,value: data.HDate
            //    }, function(value, index){
            //      obj.update({
            //        HDate: value
            //      });
            //      layer.close(index);
            //      });
            //      //layer.alert('我是编辑上');
            //  }
            //});
                if (Checkstatus.data.length != 1) {
                    return layer.msg("请选择一条数据");
                }
                else {
                    var HInterID = Checkstatus.data[0].hmainid;//获取id
                    var HBillStatus = Checkstatus.data[0].HBillStatus;//获取审核状态
                    if (HBillStatus == "1") {
                        return layer.msg("当前单据为未审核状态!无法反审核");
                    }
                    else {
                        $.ajax({
                            url: GetWEBURL() + "/Sc_ProcessMangement/CheckDeOAuditBill" //方法所在控制器和方法名
                            , type: "GET"
                            , data: { "HInterID": HInterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] }
                            , 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);
                                        //修改为功后刷新界面
                                        set_ClearBill();
                                    });
                                } else {
                                    layer.alert(result.code + result.Message, { icon: 5 });
                                }
                            }, error: function () {
                                layer.alert("接口请求失败!", { icon: 5 });
                            }
                        })
                    }
                }
            }
            //删除
            function set_DeleteBill() {
                var checkstatus = table.checkStatus("mainTable");
                if (checkstatus.data.length != 1) {
                    return layer.msg("请选择一条数据!")
                }
                else {
                    layer.confirm("是否确认删除?", {
                        btn: ["确定", "取消"]
                        , btn1: function () {
                            var ModRightNameDelete = "Sc_ProcessPlan_Drop";//删除权限
                            var HInterID = checkstatus.data[0].hmainid;
                            $.ajax({
                                url: GetWEBURL() + '/Sc_ProcessMangement/DeleteProcessBill'
                                , type: "GET"
                                , data: { "HInterID": HInterID, "User": sessionStorage["HUserName"], "ModRightNameDelete": ModRightNameDelete }
                                , 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();
                                            ////重载tree
                                            //tree.reload('treeDepartment', {});
                                        });
                                    } else {
                                        layer.alert(result.code + result.Message, { icon: 5 });
                                    }
                                }
                            })
                        }
                    })
                }
            }
            //#endregion
        });
    </script>