YL
2021-07-26 8076399458eb7ca5f4773c804f043d8d31f29426
报工平台部分卡控验证,提交前验证,提交后单据状态回写
2个文件已修改
130 ■■■■■ 已修改文件
WebTM/views/IpadIndex.html 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/生产管理/产量汇报单/Sc_Add_ProductReportBillList.html 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/IpadIndex.html
@@ -63,7 +63,7 @@
        });
        function TSLoad() {
            $("#topleft").html("");
            var HUserName = "Admin";  //sessionStorage["HUserName"];     //默认当前登录人员
            var HUserName = sessionStorage["HUserName"];  //sessionStorage["HUserName"];     //默认当前登录人员
            $.ajax({
                url: GetWEBURL() + "/ReportPlatForm/SearchGetLineBindBillList",
                type: "GET",
@@ -722,7 +722,7 @@
                        "HSourceName": HSourceName1,
                        "HICMOInterID": HICMOInterID,
                        "HICMOEntryID": HICMOEntryID,
                        "HMaker": "Admin",    //sessionStorage["HUserName"]
                        "HMaker": sessionStorage["HUserName"],    //sessionStorage["HUserName"]
                        //"HEmpID": "0",    //sessionStorage["HEmpID"]
                        "HSourceBillType": HSourceBillType
                    });
@@ -790,16 +790,16 @@
            var sWhere = "";
            switch (btn) {
                case "开工":
                    sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID+"' and hicmostatus not in('0')";   //开工状态
                    sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID+"' and hicmostatus not in('0','2')";   //是否有不为开工开工状态、停工状态
                    break;
                case "完工":
                    sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID +"' and hicmostatus not in('1','2')";   //完工状态
                    sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID +"' and hicmostatus not in('1','2')";   //是否有不为开工、完工状态
                    break;
                case "停工":
                    sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID +"' and hicmostatus not in('1')";   //停工挂起状态
                    sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID +"' and hicmostatus not in('1')";   //是否有不为停工挂起状态
                    break;
                case "汇报":
                    sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID + "' and hicmostatus not in('1')";   //汇报状态
                    sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID + "' and hicmostatus not in('1','2')";   //是否有不为开工、停工挂起状态
                    break;
                case "报检申请":
                    
WebTM/views/Éú²ú¹ÜÀí/²úÁ¿»ã±¨µ¥/Sc_Add_ProductReportBillList.html
@@ -468,7 +468,6 @@
                            if (data.count == 1)// è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            {
                                var LoadData = data.data.h_p_JIT_GetInfoByICMOStatusInterID;
                                console.log(LoadData);
                                $("#HProcID").val(LoadData[0].HProcID); //当前工序ID
                                $("#HProcName").val(LoadData[0].HProcName); //当前工序
                                $("#HMaterID").val(LoadData[0].HMaterID); //产品ID
@@ -499,47 +498,17 @@
                            layer.alert(err, { icon: 5 });
                        }
                    });
                console.log($("#HSourceInterID").val());
            }
            //保存提交
            form.on('submit(Saver)', function (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;
                }
                return false;
                var sMainStr = JSON.stringify(data.field);
            form.on('submit(Saver)', function (data)
            {
                if (!AllowLoadData())//数据验证
                {
                    return false;
                }
                $.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 })
                    }
                })
                OverStepQty();
            });
            //退出
@@ -706,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: "温馨提示" });
@@ -753,6 +795,10 @@
            }
            return Result;
        }
    </script>
</body>
</html>