ch
2021-07-30 d33cf0d26eb0dfd4ec9ce5ccedf45c12ea2001dd
WebTM/views/Éú²ú¹ÜÀí/²úÁ¿»ã±¨µ¥/Sc_Add_ProductReportBillList.html
@@ -108,7 +108,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 +133,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 +186,7 @@
                                                            </button>
                                                        </div>
                                                    </div>
                                                    <div class="layui-inline">
                                                        <label class="layui-form-label">生产班组:</label>
                                                        <div class="layui-input-inline">
@@ -199,8 +202,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>
@@ -431,7 +434,8 @@
            //有源单新增
            if (Type == 2) {
            if (Type == 2)
            {
                //加源单类型区分(可以写不同的方法)
                $('#HICMOBillNo').attr("disabled", true);
@@ -457,13 +461,13 @@
                            "HSourceInterID": HSourceInterID,
                            "HSourceEntryID": HSourceEntryID,
                            "HSourceBillNo": HSourceBillNo,
                            "HSourceBillType": HSourceBillType
                            "HSourceBillType": HBillType
                        },
                        dataType: "json",
                        success: function (data) {
                            if (data.count == 1)// è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            {
                                var LoadData = data.data.h_p_JIT_GetSourceInfoByUser;
                                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
@@ -472,10 +476,10 @@
                                $("#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); //源单类型
                                $("#HSourceBillNo").val(LoadData[0].HICMOBillNo); //源单单号(暂时取值订单编号)
                                $("#HSourceInterID").val(LoadData[0].HSourceInterID); //源单主内码(取值HInterID)
                                $("#HSourceEntryID").val(LoadData[0].HSourceEntryID); //源单子内码(源单行号)
                                $("#HSourceBillType").val(HSourceBillType); //源单类型
                                $("#HDeptID").val(LoadData[0].HDeptID); //车间ID
                                $("#HDeptName").val(LoadData[0].HDeptName); //车间
                                $("#HICMOInterID").val(LoadData[0].HICMOInterID); //生产订单ID
@@ -483,6 +487,7 @@
                                $("#HICMOBillNo").val(LoadData[0].HICMOBillNo); //生产订单
                                $("#HWorkBeginDate").val(LoadData[0].HBeginDate); //开工时间
                                $("#HPlanQty").val(LoadData[0].HDatePlanQty); //计划数量
                            }
                            else {
                                layer.alert(data.Message, { icon: 5 });
@@ -495,35 +500,15 @@
                    });
            }
            //保存提交
            form.on('submit(Saver)', function (data) {
                var sMainStr = JSON.stringify(data.field);
            form.on('submit(Saver)', function (data)
            {
                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();
            });
            //退出
@@ -631,8 +616,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 +675,83 @@
            //验证汇报数量是否超过计划数量
            function OverStepQty() {
                var sWhere = "";
                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 (data) {
                        var LoadData = data.data.Sc_ICMOBillWorkQtyStatus_Tmp;
                        var HQty = 200;//LoadData[0].HQty;
                        var HBadQty = 100;// LoadData[0].HBadQty;
                        var HWasterQty = 10;// 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();
                            }, function () {
                            });
                        }
                        else {
                            Submit();
                        }
                    },
                    error: function (err) {
                        layer.alert(err, { icon: 5 })
                    }
                });
            }
            //提交请求ajax
            function Submit()
            {
                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);
                $.ajax({
                    type: "POST",
                    url: GetWEBURL() + "/Sc_MESBeginWorkBill/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 })
                    }
                })
            }
            //以上为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 +765,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 +777,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;
            }
@@ -737,6 +795,10 @@
            }
            return Result;
        }
    </script>
</body>
</html>