From acadfc413aeea932667c60ccfdf8866d994ddd2b Mon Sep 17 00:00:00 2001
From: zgq <519541279@qq.com>
Date: 星期四, 05 八月 2021 10:54:07 +0800
Subject: [PATCH] 1

---
 WebTM/views/生产管理/产量汇报单/Sc_Add_ProductReportBillList.html |  111 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 83 insertions(+), 28 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\272\247\351\207\217\346\261\207\346\212\245\345\215\225/Sc_Add_ProductReportBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\272\247\351\207\217\346\261\207\346\212\245\345\215\225/Sc_Add_ProductReportBillList.html"
index 6c41f55..631d1e7 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\272\247\351\207\217\346\261\207\346\212\245\345\215\225/Sc_Add_ProductReportBillList.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\272\247\351\207\217\346\261\207\346\212\245\345\215\225/Sc_Add_ProductReportBillList.html"
@@ -461,14 +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_GetInfoByICMOStatusInterID;
-                                console.log(LoadData);
                                 $("#HProcID").val(LoadData[0].HProcID); //褰撳墠宸ュ簭ID
                                 $("#HProcName").val(LoadData[0].HProcName); //褰撳墠宸ュ簭
                                 $("#HMaterID").val(LoadData[0].HMaterID); //浜у搧ID
@@ -499,38 +498,17 @@
                             layer.alert(err, { icon: 5 });
                         }
                     });
-                console.log($("#HSourceInterID").val());
             }
 
-
             //淇濆瓨鎻愪氦
-            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_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(data);
+              
             });
 
             //閫�鍑�
@@ -697,10 +675,83 @@
 
 
 
+            //楠岃瘉姹囨姤鏁伴噺鏄惁瓒呰繃璁″垝鏁伴噺
+            function OverStepQty(data) {
+                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 (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);
+            
+
+                $.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 })
+                    }
+                })
+            }
             //浠ヤ笂涓簂ayui妯″潡
         });
 
-        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: "娓╅Θ鎻愮ず" });
@@ -744,6 +795,10 @@
             }
             return Result;
         }
+
+       
+
+      
     </script>
 </body>
 </html>

--
Gitblit v1.9.1