yangle
2022-12-03 0b00f4e910d52fc70e109d5e51aaab1ac2c8cd22
WebTM/views/Éú²ú¹ÜÀí/²úÁ¿»ã±¨µ¥/Sc_Add_ProductReportBillList.html
@@ -14,6 +14,7 @@
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <style type="text/css">
        .layui-form-label {
@@ -87,6 +88,8 @@
                            <div class="layui-btn-group">
                                <button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">保存</button>
                                <button type="button" id="VerIfySaver" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="VerIfySaver">审核</button>
                                <button type="button" id="ReVerIfySaver" class="layui-btn layui-btn-normal layui-btn-circle" lay-submit="" lay-filter="ReVerIfySaver">反审核</button>
                                <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">退出</button>
                            </div>
@@ -108,7 +111,7 @@
                                                        <div class="layui-input-inline">
                                                            <input class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" disabled autocomplete="off">
                                                            <input id="HInterID" name="HInterID" type="hidden" />
                                                            <input id="HMaker" name="HMaker" type="hidden" /><!--制单人-->
                                                        </div>
                                                    </div>
                                                    <div class="layui-inline">
@@ -133,6 +136,8 @@
                                                            <input class="layui-input" name="HProcExchBillNo" lay-verify="HProcExchBillNo" id="HProcExchBillNo" autocomplete="off">
                                                            <input id="HSourceInterID" name="HSourceInterID" type="hidden" />
                                                            <input id="HSourceEntryID" name="HSourceEntryID" type="hidden" />
                                                            <input type="hidden" name="HSourceBillNo" id="HSourceBillNo">
                                                            <input type="hidden" name="HSourceBillType" id="HSourceBillType">
                                                        </div>
                                                    </div>
                                                    <div class="layui-inline">
@@ -184,6 +189,7 @@
                                                            </button>
                                                        </div>
                                                    </div>
                                                    <div class="layui-inline">
                                                        <label class="layui-form-label">生产班组:</label>
                                                        <div class="layui-input-inline">
@@ -199,8 +205,8 @@
                                                    <div class="layui-inline">
                                                        <label class="layui-form-label">操作员:</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="HEmpName" id="HEmpName" class="layui-input" value="" style="float:left;width:150px;">
                                                            <input type="hidden" name="HEmpID" id="HEmpID" class="layui-input" value="" style="float:left;width:150px;">
                                                            <input type="text" name="HWorkManName" id="HWorkManName" class="layui-input" value="" style="float:left;width:150px;">
                                                            <input type="hidden" name="HWorkManID" id="HWorkManID" class="layui-input" value="" style="float:left;width:150px;">
                                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" id="HEmpList" style="width:40px;">
                                                                <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                                            </button>
@@ -330,20 +336,16 @@
        var HSourceEntryID = "";  //源单子内码
        var HSourceBillNo = "";   //源单单号
        var HSourceBillType = "";  //源单类型
        function getUrlVars() {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        var refSav = "";   //提交类型
        //获取页面跳转参数  //单据编辑状态: 1.无源单新增  Â 2.有源单新增  Â 3.编辑  4.浏览  5.变更
        var params = get_UrlVars();
        if (typeof (params[params[0]]) == "undefined") {
            var OperationType = 1;//操作类型
        } else {
            var OperationType = params[params[0]];//操作类型
            var linterid = params[params[1]];//源单id
            var HSBillType = params[params[2]];//源单类型
        }
        var params = getUrlVars();
        var hID = params[params[0]];//编辑查看
        var Type = params[params[1]];//单据编辑状态: 1.无源单新增  Â 2.有源单新增  Â 3.编辑  4.浏览  5.变更
        var edit = function (data) {
            HBillType = data[0].HBillType;
@@ -360,6 +362,7 @@
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
            //#region å…¬ç”¨å˜é‡
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
@@ -367,49 +370,231 @@
                , form = layui.form
                , laydate = layui.laydate
                , element = layui.element;
            //#endregion
            //日期时间选择器
            laydate.render({
                elem: '#HWorkBeginDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HWorkReportDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HMakeDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HUpDateDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HCheckDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HCloseDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HDeleteDate'
                , type: 'datetime'
            });
            //初始化表单插件
            set_InitFrom();
            //初始基本信息赋值
            $("#HDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));      //单据日期
            $("#HWorkReportDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"))  //报工日期
            $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));  //制单日期
            $("#HMaker").val(sessionStorage["HUserName"]);     //制单人
            //判断操作类型
            if (OperationType == 1) {//无源单
                set_AddFNew();
            }
            else if (OperationType == 2) {//有源单
                set_AddNew();
            }
            else if (OperationType == 3) {//编辑
                var HICMOInID = params[params[3]];//生产订单主主ID
                var HICMOEnID = params[params[4]];//生产订单子ID
                set_EditFromGrid(linterid, HICMOInID, HICMOEnID);
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
            }
            //初始化插件
            function set_InitFrom() {
                //日期时间选择器
                laydate.render({
                    elem: '#HWorkBeginDate'
                    , type: 'datetime'
                });
                laydate.render({
                    elem: '#HWorkReportDate'
                    , type: 'datetime'
                });
                laydate.render({
                    elem: '#HDate'
                    , type: 'datetime'
                });
                laydate.render({
                    elem: '#HMakeDate'
                    , type: 'datetime'
                });
                laydate.render({
                    elem: '#HUpDateDate'
                    , type: 'datetime'
                });
                laydate.render({
                    elem: '#HCheckDate'
                    , type: 'datetime'
                });
                laydate.render({
                    elem: '#HCloseDate'
                    , type: 'datetime'
                });
                laydate.render({
                    elem: '#HDeleteDate'
                    , type: 'datetime'
                });
            }
            //无源单新增
            function set_AddFNew()
            {
            }
            //有源单新增
            function set_AddNew() {
                refSav = "Add";
                //初始基本信息赋值
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));      //单据日期
                $("#HWorkReportDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"))  //报工日期
                $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));  //制单日期
                $("#HMaker").val(sessionStorage["HUserName"]);     //制单人
                //加源单类型区分(可以写不同的方法)
                $('#HICMOBillNo').attr("disabled", true);
                $('#HSourceBillNo').attr("disabled", true);
                $('#HProcExchBillNo').attr("disabled", true);
                $('#HProcName').attr("disabled", true);
                $('#HMaterCode').attr("disabled", true);
                $('#HMaterList').addClass("layui-btn-disabled").attr("disabled", true);
                $('#HMaterName').attr("disabled", true);
                $('#HMaterSpec').attr("disabled", true);
                $('#HPlanQty').attr("disabled", true);
                $('#HSourceName').attr("disabled", true);
                $('#HSourceList').addClass("layui-btn-disabled").attr("disabled", true);
                $('#HWorkBeginDate').attr("disabled", true);
                $('#HWorkReportDate').attr("disabled", true);
                $.ajax(
                    {
                        type: "GET",
                        url: GetWEBURL() + "/Sc_MESBeginWorkBill/GetMESBeginWorkFrom", //方法所在页面和方法名
                        async: true,
                        data: {
                            "HSourceInterID": HSourceInterID,
                            "HSourceEntryID": HSourceEntryID,
                            "HSourceBillNo": HSourceBillNo,
                            "HSourceBillType": HBillType
                        },
                        dataType: "json",
                        success: function (data) {
                            if (data.count == 1)// è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            {
                                var LoadData = data.data.h_p_JIT_GetInfoByICMOStatusInterID;
                                $("#HProcID").val(LoadData[0].HProcID); //当前工序ID
                                $("#HProcName").val(LoadData[0].HProcName); //当前工序
                                $("#HMaterID").val(LoadData[0].HMaterID); //产品ID
                                $("#HMaterCode").val(LoadData[0].HMaterNumber); //产品代码
                                $("#HMaterName").val(LoadData[0].HMaterName); //产品名称
                                $("#HMaterSpec").val(LoadData[0].HModel); //产品规格
                                $("#HSourceID").val(LoadData[0].HSourceID); //生产资源ID
                                $("#HSourceName").val(LoadData[0].HSourceName); //生产资源
                                $("#HSourceBillNo").val(LoadData[0].HICMOBillNo); //源单单号(暂时取值订单编号)
                                $("#HSourceInterID").val(LoadData[0].HSourceInterID); //源单主内码(取值HInterID)
                                $("#HSourceEntryID").val(LoadData[0].HSourceEntryID); //源单子内码(源单行号)
                                $("#HSourceBillType").val(HSourceBillType); //源单类型
                                $("#HGroupID").val(LoadData[0].HDeptID); //班组ID
                                $("#HGroupName").val(LoadData[0].HDeptName); //班组
                                $("#HICMOInterID").val(LoadData[0].HICMOInterID); //生产订单ID
                                $("#HICMOEntryID").val(LoadData[0].HICMOEntryID); //生产订单子ID
                                $("#HICMOBillNo").val(LoadData[0].HICMOBillNo); //生产订单
                                $("#HWorkBeginDate").val(LoadData[0].HBeginDate); //开工时间
                                $("#HPlanQty").val(LoadData[0].HDatePlanQty); //计划数量
                            }
                            else {
                                layer.alert(data.Message, { icon: 5 });
                            }
                        },
                        error: function (err) {
                            layer.alert(err, { icon: 5 });
                        }
                    });
            }
            //编辑
            function set_EditFromGrid(linterid, HICMOInID, HICMOEnID)
            {
                refSav = "Update";
                //加源单类型区分(可以写不同的方法)
                $('#HICMOBillNo').attr("disabled", true);
                $('#HSourceBillNo').attr("disabled", true);
                $('#HProcExchBillNo').attr("disabled", true);
                $('#HProcName').attr("disabled", true);
                $('#HMaterCode').attr("disabled", true);
                $('#HMaterList').addClass("layui-btn-disabled").attr("disabled", true);
                $('#HMaterName').attr("disabled", true);
                $('#HMaterSpec').attr("disabled", true);
                $('#HPlanQty').attr("disabled", true);
                $('#HSourceName').attr("disabled", true);
                $('#HSourceList').addClass("layui-btn-disabled").attr("disabled", true);
                $('#HWorkBeginDate').attr("disabled", true);
                $('#HWorkReportDate').attr("disabled", true);
                $.ajax(
                    {
                        type: "GET",
                        url: GetWEBURL() + "/Sc_MESProductReportBill/Get_Sc_MESProductReportEditBillList", //方法所在页面和方法名
                        async: true,
                        data: {
                            "linterid": linterid,
                            "HICMOInID": HICMOInID,
                            "HICMOEnID": HICMOEnID,
                        },
                        dataType: "json",
                        success: function (data) {
                            if (data.count == 1)// è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            {
                                var LoadData = data.data.h_v_IF_ICMOBillWorkQtyStatus_Tmp;
                                $("#HInterID").val(LoadData[0].HInterID); //单据ID
                                $("#HBillNo").val(LoadData[0].单据号); //单据号
                                $("#HDate").val(formatDate(LoadData[0].日期)); //日期
                                $("#HProcID").val(""); //当前工序ID
                                $("#HProcName").val(""); //当前工序
                                $("#HMaterID").val(LoadData[0].HMaterID); //产品ID
                                $("#HMaterCode").val(LoadData[0].产品代码); //产品代码
                                $("#HMaterName").val(LoadData[0].产品名称); //产品名称
                                $("#HMaterSpec").val(LoadData[0].产品规格); //产品规格
                                $("#HSourceID").val(LoadData[0].HSourceID); //生产资源ID
                                $("#HSourceName").val(LoadData[0].生产资源); //生产资源
                                $("#HSourceBillNo").val(LoadData[0].源单单号); //源单单号(暂时取值订单编号)
                                $("#HSourceInterID").val(LoadData[0].HSourceInterID); //源单主内码(取值HInterID)
                                $("#HSourceEntryID").val(LoadData[0].HSourceEntryID); //源单子内码(源单行号)
                                $("#HSourceBillType").val(LoadData[0].源单类型); //源单类型
                                $("#HGroupID").val(LoadData[0].HDeptID); //班组ID
                                $("#HGroupName").val(LoadData[0].生产班组); //班组
                                $("#HWorkManID").val(LoadData[0].HWorkManID); //操作员ID
                                $("#HWorkManName").val(LoadData[0].操作员); //操作员
                                $("#HICMOInterID").val(LoadData[0].HICMOInterID); //生产订单ID
                                $("#HICMOEntryID").val(LoadData[0].HICMOEntryID); //生产订单子ID
                                $("#HICMOBillNo").val(LoadData[0].HICMOBillNo); //生产订单
                                $("#HWorkBeginDate").val(formatDate(LoadData[0].开工时间)); //开工时间
                                $("#HWorkReportDate").val(formatDate(LoadData[0].报工时间)); //报工时间
                                $("#HPlanQty").val(LoadData[0].HDatePlanQty); //计划数量
                                $("#HQty").val(LoadData[0].汇报数量); //报工数量
                                $("#HBadQty").val(LoadData[0].不良数量); //不良数量
                                $("#HWasterQty").val(LoadData[0].报废数量); //报废数量
                                $("#HMaker").val(LoadData[0].制单人); //制单人
                                $("#HMakeDate").val(formatDate(LoadData[0].制单日期)); //制单日期
                                $("#HUpDater").val(sessionStorage["HUserName"]); //修改人
                                $("#HUpDateDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss")); //修改日期
                                $("#HChecker").val(LoadData[0].审核人); //审核人
                                $("#HCheckDate").val(formatDate(LoadData[0].审核日期)); //审核日期
                                $("#HCloseMan").val(LoadData[0].关闭人); //关闭人
                                $("#HCloseDate").val(formatDate(LoadData[0].关闭日期)); //关闭日期
                                $("#HDeleteMan").val(LoadData[0].作废人); //作废人
                                $("#HDeleteDate").val(formatDate(LoadData[0].作废日期)); //作废日期
                            }
                            else {
                                layer.alert(data.Message, { icon: 5 });
                            }
                        },
                        error: function (err) {
                            layer.alert(err, { icon: 5 });
                        }
                    });
            }
            //判断是否新增
            if (hID == null || hID == 0) {
            if (linterid == null || linterid == 0) {
                //获取最大单据号 new
                $("#HInterID").val("0");
                $("#HBillNo").val("");
@@ -424,112 +609,55 @@
                });
            }
            else {//如果修改则走下面 new
                $("#HInterID").val(hID);//修改时主表ID
                RoadBillMain(hID);
                /* RoadBillSub(linterid);*/
                $("#HInterID").val(linterid);//修改时主表ID
            }
            //编辑获取表体时时间格式矫正方式
            function formatDate(date) {
                var d = new Date(date),
                    month = '' + (d.getMonth() + 1).toString(),
                    day = '' + d.getDate().toString(),
                    year = d.getFullYear().toString(),
                    h = d.getHours().toString(),
                    mm = d.getMinutes().toString(),
                    s = d.getSeconds().toString();
            //有源单新增
            if (Type == 2) {
                if (month.length < 2) month = '0' + month;
                if (day.length < 2) day = '0' + day;
                if (h.length < 2) h = '0' + h;
                if (mm.length < 2) mm = '0' + mm;
                if (s.length < 2) s = '0' + s;
                //加源单类型区分(可以写不同的方法)
                $('#HICMOBillNo').attr("disabled", true);
                $('#HSourceBillNo').attr("disabled", true);
                $('#HProcExchBillNo').attr("disabled", true);
                $('#HProcName').attr("disabled", true);
                $('#HMaterCode').attr("disabled", true);
                $('#HMaterList').addClass("layui-btn-disabled").attr("disabled", true);
                $('#HMaterName').attr("disabled", true);
                $('#HMaterSpec').attr("disabled", true);
                $('#HPlanQty').attr("disabled", true);
                $('#HSourceName').attr("disabled", true);
                $('#HSourceList').addClass("layui-btn-disabled").attr("disabled", true);
                $('#HWorkBeginDate').attr("disabled", true);
                $('#HWorkReportDate').attr("disabled", true);
                $.ajax(
                    {
                        type: "GET",
                        url: GetWEBURL() + "/Sc_MESBeginWorkBill/GetMESBeginWorkFrom", //方法所在页面和方法名
                        async: true,
                        data: {
                            "HSourceInterID": HSourceInterID,
                            "HSourceEntryID": HSourceEntryID,
                            "HSourceBillNo": HSourceBillNo,
                            "HSourceBillType": HSourceBillType
                        },
                        dataType: "json",
                        success: function (data) {
                            if (data.count == 1)// è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            {
                                var LoadData = data.data.h_p_JIT_GetSourceInfoByUser;
                                $("#HProcID").val(LoadData[0].HProcID); //当前工序ID
                                $("#HProcName").val(LoadData[0].HProcName); //当前工序
                                $("#HMaterID").val(LoadData[0].HMaterID); //产品ID
                                $("#HMaterCode").val(LoadData[0].HMaterNumber); //产品代码
                                $("#HMaterName").val(LoadData[0].HMaterName); //产品名称
                                $("#HMaterSpec").val(LoadData[0].HModel); //产品规格
                                $("#HSourceID").val(LoadData[0].HSourceID); //生产资源ID
                                $("#HSourceName").val(LoadData[0].HSourceName); //生产资源
                                $("#HMainSourceBillNo").val(LoadData[0].HSourceBillNo); //源单单号
                                $("#HMainSourceInterID").val(LoadData[0].HSourceInterID); //源单主内码
                                $("#HMainSourceEntryID").val(LoadData[0].HSourceEntryID); //源单子内码(源单行号)
                                $("#HMainSourceBillType").val(HSourceBillType); //源单类型
                                $("#HDeptID").val(LoadData[0].HDeptID); //车间ID
                                $("#HDeptName").val(LoadData[0].HDeptName); //车间
                                $("#HICMOInterID").val(LoadData[0].HICMOInterID); //生产订单ID
                                $("#HICMOEntryID").val(LoadData[0].HICMOEntryID); //生产订单子ID
                                $("#HICMOBillNo").val(LoadData[0].HICMOBillNo); //生产订单
                                $("#HWorkBeginDate").val(LoadData[0].HBeginDate); //开工时间
                                $("#HPlanQty").val(LoadData[0].HDatePlanQty); //计划数量
                            }
                            else {
                                layer.alert(data.Message, { icon: 5 });
                            }
                        },
                        error: function (err) {
                            layer.alert(err, { icon: 5 });
                        }
                    });
                return [year, month, day].join('-') + " " + [h, mm, s].join(':');
            }
            //保存提交
            form.on('submit(Saver)', function (data) {
                var sMainStr = JSON.stringify(data.field);
                if (!AllowLoadData())//数据验证
                {
                    return false;
                }
                $.ajax({
                    type: "POST",
                    url: GetWEBURL() + "/Sc_ICMOReportBill/SaveGetMESProductReportFrom", //方法所在页面和方法名
                    async: true,
                    data: { "msg": sMainStr },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            layer.msg(data.Message, { time: 1 * 2000, icon: 1 }, function (index) {
                                layer.close(layer.index);
                                window.parent.location.reload();
                            });
                        }
                        else {
                            layer.alert(data.Message, { icon: 5 })
                        }
                    },
                    error: function (err) {
                        layer.alert(err, { icon: 5 })
                    }
                })
                OverStepQty(data);
            });
            //审核
            form.on('submit(VerIfySaver)', function (data)
            {
                SaveVerify();
            });
            //反审核
            form.on('submit(ReVerIfySaver)', function (data)
            {
                ReVerIfySaver();
            });
            //退出
            form.on('submit(Exit)', function (data) {
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
                Pub_Close(1);
            });
@@ -631,8 +759,8 @@
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HEmpName").val(checkStatus.data[0].HName);
                        $("#HEmpID").val(checkStatus.data[0].HItemID);
                        $("#HWorkManName").val(checkStatus.data[0].HName);
                        $("#HWorkManID").val(checkStatus.data[0].HItemID);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
@@ -690,10 +818,165 @@
            //验证汇报数量是否超过计划数量
            function OverStepQty(data) {
                var sWhere = "";
                if (OperationType == 3) //编辑
                {
                    HSourceInterID = $("#HSourceInterID").val();
                    HSourceEntryID = $("#HSourceEntryID").val();
                    HSourceBillNo = $("#HSourceBillNo").val();
                    HSourceBillType = $("#HSourceBillType").val();
                }
                sWhere = " where  HSourceID='" + $("#HSourceID").val() + "' and  HSourceInterID='" + HSourceInterID + "' and HSourceEntryID='" + HSourceEntryID + "' and HSourceBillNo='" + HSourceBillNo + "' and HSourceBillType='" + HSourceBillType + "' ";
                $.ajax({
                    url: GetWEBURL() + "/Sc_MESBeginWorkBill/GetMESOverStepQty",
                    type: "GET",
                    data: { "sWhere": sWhere },
                    dataType: "json",//数据类型可以为 text xml json  script  jsonp
                    async: false,
                    success: function (datas) {
                        var LoadData = datas.data.Sc_ICMOBillWorkQtyStatus_Tmp;
                        var HQty = LoadData[0].HQty;
                        var HBadQty = LoadData[0].HBadQty;
                        var HWasterQty = LoadData[0].HWasterQty;
                        var yessqty = HQty + HBadQty + HWasterQty;
                        var sumqty = parseFloat($("#HQty").val()) + yessqty;
                        if (sumqty > parseFloat($("#HPlanQty").val())) {
                            layer.confirm("已汇报数量:【" + yessqty + "】,当前汇报数量:【" + parseFloat($("#HQty").val()) + "】不能大于计划数量:【" + parseFloat($("#HPlanQty").val()) + "】!", {
                                btn: ['确认', '取消']
                            }, function (index) {
                                //关闭当前frame
                                layer.close(index);
                                //Submit(data);
                            }, function () {
                            });
                        }
                        else {
                            Submit(data);
                        }
                    },
                    error: function (err) {
                        layer.alert(err, { icon: 5 })
                    }
                });
            }
            //提交请求ajax
            function Submit(data) {
                if (data.field.HBadQty == "" || data.field.HBadQty == null) {
                    data.field.HBadQty = 0;
                }
                if (data.field.HWasterQty == "" || data.field.HWasterQty == null) {
                    data.field.HWasterQty = 0;
                }
                var sMainStr = JSON.stringify(data.field);
                var sMainSub = sMainStr + ';' + refSav;
                $.ajax({
                    type: "POST",
                    url: GetWEBURL() + "/Sc_MESBeginWorkBill/SaveGetMESProductReportFrom", //方法所在页面和方法名
                    async: false,
                    data: { "msg": sMainSub },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            $("#HInterID").val(data.HInterID);//获取提交成功返回的单据主ID
                            layer.confirm(data.Message, {
                                btn: ['确认']
                            }, function (index) {
                                if (data.Verify == "Y") //自动审核
                                {
                                    layer.close(index);
                                    SaveVerify(); //审核
                                }
                                else {
                                    layer.close(index);
                                }
                            });
                        }
                        else {
                            layer.alert(data.Message, { icon: 5 })
                        }
                    },
                    error: function (err) {
                        layer.alert(err, { icon: 5 })
                    }
                })
            }
            //审核提交
            function SaveVerify()
            {
                var HSourceID = $("#HSourceID").val();  //生产资源ID
                var HSourceInterID = $("#HSourceInterID").val(); //源单主内码
                var HSourceEntryID = $("#HSourceEntryID").val();//源单子内码
                var HSourceBillNo = $("#HSourceBillNo").val();//源单单号
                var HICMOInterID = $("#HICMOInterID").val();//生产订单主ID
                var HICMOEntryID = $("#HICMOEntryID").val();//生产订单子ID
                var HInterID = $("#HInterID").val();//产量汇报临时表主ID
                if (!AllowLoadData())//数据验证
                {
                    return false;
                }
                //逻辑审核方法
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Sc_MESBeginWorkBill/MESProductAuditProcessReportList", //方法所在页面和方法名
                    data: { "HSourceID": HSourceID, "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID, "HSourceBillNo": HSourceBillNo, "HICMOInterID": HICMOInterID, "HICMOEntryID": HICMOEntryID, "HInterID": HInterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] },
                    success: function (result) {
                        if (result.count == 1) {
                            layer.msg(result.Message, { time: 1 * 2000, icon: 1 }, function () {
                            });
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //反审核提交
            function ReVerIfySaver()
            {
                var HSourceID = $("#HSourceID").val();  //生产资源ID
                var HSourceInterID = $("#HSourceInterID").val(); //源单主内码
                var HSourceEntryID = $("#HSourceEntryID").val();//源单子内码
                var HSourceBillNo = $("#HSourceBillNo").val();//源单单号
                var HICMOInterID = $("#HICMOInterID").val();//生产订单主ID
                var HICMOEntryID = $("#HICMOEntryID").val();//生产订单子ID
                var HInterID = $("#HInterID").val();//产量汇报临时表主ID
                if (!AllowLoadData())//数据验证
                {
                    return false;
                }
                //逻辑审核方法
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Sc_MESBeginWorkBill/MESProductAuditProcessReportList", //方法所在页面和方法名
                    data: { "HSourceID": HSourceID, "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID, "HSourceBillNo": HSourceBillNo, "HICMOInterID": HICMOInterID, "HICMOEntryID": HICMOEntryID, "HInterID": HInterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] },
                    success: function (result) {
                        if (result.count == 1) {
                            layer.msg(result.Message, { time: 1 * 2000, icon: 1 }, function () {
                            });
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //以上为layui模块
        });
        function AllowLoadData() {  //非空验证
        //非空验证
        function AllowLoadData() {
            var Result = true;
            if ($("#HBillNo").val() == '' || $("#HBillNo").val() == null) {
                layer.msg("单据号不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
@@ -707,11 +990,11 @@
                layer.msg("产品编码不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
            if ($("#HWorkBeginDate").val() == '' || $("#HBeginDate").val() == null) {
            if ($("#HWorkBeginDate").val() == '' || $("#HWorkBeginDate").val() == null) {
                layer.msg("开工时间不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
            if ($("#HWorkReportDate").val() == '' || $("#HBeginDate").val() == null) {
            if ($("#HWorkReportDate").val() == '' || $("#HWorkReportDate").val() == null) {
                layer.msg("开工时间不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
@@ -719,7 +1002,7 @@
                layer.msg("生产资源不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
            if ($("#HEmpID").val() == '' || $("#HEmpID").val() == null) {
            if ($("#HWorkManID").val() == '' || $("#HWorkManID").val() == null) {
                layer.msg("操作员不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
@@ -730,13 +1013,17 @@
            if ($("#HGroupID").val() == '' || $("#HGroupID").val() == null) {
                layer.msg("班组不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
            }
            if ($("#HICMOInterID").val() == '' || $("#HICMOInterID").val() == null) {
                layer.msg("生产订单不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
            return Result;
        }
    </script>
</body>
</html>