From 8076399458eb7ca5f4773c804f043d8d31f29426 Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期一, 26 七月 2021 22:46:46 +0800
Subject: [PATCH] 报工平台部分卡控验证,提交前验证,提交后单据状态回写

---
 WebTM/views/生产管理/产量汇报单/Sc_Add_ProductReportBillList.html |  118 +++++++++++++++++++++++++++------------
 WebTM/views/IpadIndex.html                               |   12 ++--
 2 files changed, 88 insertions(+), 42 deletions(-)

diff --git a/WebTM/views/IpadIndex.html b/WebTM/views/IpadIndex.html
index c3a1be1..41fbc2f 100644
--- a/WebTM/views/IpadIndex.html
+++ b/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 "鎶ユ鐢宠":
                     
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 26f04da..9c99851 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"
@@ -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 })
+                    }
+                })
+            }
             //浠ヤ笂涓簂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: "娓╅Θ鎻愮ず" });
@@ -753,6 +795,10 @@
             }
             return Result;
         }
+
+       
+
+      
     </script>
 </body>
 </html>

--
Gitblit v1.9.1