From 2ace77c833ab4e37b76c644fbdf0f7ce366979cf Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 11 三月 2024 10:58:42 +0800
Subject: [PATCH] 计划平台优化完善 报工平台 报检申请 生产汇报 功能优化完善

---
 WebTM/views/生产管理/产量汇报单/Sc_Add_ProductReportBillList.html |  595 ++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 447 insertions(+), 148 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..822c570 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"
@@ -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" />
-                                                            
+
                                                         </div>
                                                     </div>
                                                     <div class="layui-inline">
@@ -333,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;
@@ -363,6 +362,7 @@
         }).extend({
             index: 'lib/index' //涓诲叆鍙fā鍧�
         }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
+            //#region 鍏敤鍙橀噺
             var $ = layui.$
                 , admin = layui.admin
                 , layer = layui.layer
@@ -370,49 +370,239 @@
                 , 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) {//鏃犳簮鍗�
+                $("#HWorkManID").val(sessionStorage["HEmpID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛業D
+                $("#HWorkManName").val(sessionStorage["HEmpName"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛�
+                $("#HGroupID").val(sessionStorage["HGroupID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍ID
+                $("#HGroupName").val(sessionStorage["HGroup"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍
+                set_AddFNew();
+            }
+            else if (OperationType == 2) {//鏈夋簮鍗�
+                $("#HWorkManID").val(sessionStorage["HEmpID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛業D
+                $("#HWorkManName").val(sessionStorage["HEmpName"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛�
+                $("#HGroupID").val(sessionStorage["HGroupID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍ID
+                $("#HGroupName").val(sessionStorage["HGroup"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍
+                set_AddNew();
+            }
+            else if (OperationType == 3) {//缂栬緫
+                var HICMOInID = params[params[3]];//鐢熶骇璁㈠崟涓讳富ID
+                var HICMOEnID = params[params[4]];//鐢熶骇璁㈠崟瀛怚D
+                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); //浜у搧浠g爜
+                                $("#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); //婧愬崟涓诲唴鐮�(鍙栧�糎InterID)
+                                $("#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); //鐢熶骇璁㈠崟瀛怚D
+                                $("#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].浜у搧浠g爜); //浜у搧浠g爜
+                                $("#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); //婧愬崟涓诲唴鐮�(鍙栧�糎InterID)
+                                $("#HSourceEntryID").val(LoadData[0].HSourceEntryID); //婧愬崟瀛愬唴鐮�(婧愬崟琛屽彿)
+                                $("#HSourceBillType").val(LoadData[0].婧愬崟绫诲瀷); //婧愬崟绫诲瀷
+                                $("#HGroupID").val(LoadData[0].HDeptID); //鐝粍ID
+                                $("#HGroupName").val(LoadData[0].鐢熶骇鐝粍); //鐝粍
+                                $("#HWorkManID").val(LoadData[0].HWorkManID); //鎿嶄綔鍛業D
+                                $("#HWorkManName").val(LoadData[0].鎿嶄綔鍛�); //鎿嶄綔鍛�
+                                $("#HICMOInterID").val(LoadData[0].HICMOInterID); //鐢熶骇璁㈠崟ID
+                                $("#HICMOEntryID").val(LoadData[0].HICMOEntryID); //鐢熶骇璁㈠崟瀛怚D
+                                $("#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("");
@@ -427,116 +617,55 @@
                 });
             }
             else {//濡傛灉淇敼鍒欒蛋涓嬮潰 new
-                $("#HInterID").val(hID);//淇敼鏃朵富琛↖D
-                RoadBillMain(hID);
-                /* RoadBillSub(linterid);*/
+                $("#HInterID").val(linterid);//淇敼鏃朵富琛↖D
             }
 
+            //缂栬緫鑾峰彇琛ㄤ綋鏃舵椂闂存牸寮忕煫姝f柟寮�
+            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_GetInfoByICMOStatusInterID;
-                                console.log(LoadData);
-                                $("#HProcID").val(LoadData[0].HProcID); //褰撳墠宸ュ簭ID
-                                $("#HProcName").val(LoadData[0].HProcName); //褰撳墠宸ュ簭
-                                $("#HMaterID").val(LoadData[0].HMaterID); //浜у搧ID
-                                $("#HMaterCode").val(LoadData[0].HMaterNumber); //浜у搧浠g爜
-                                $("#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); //婧愬崟涓诲唴鐮�(鍙栧�糎InterID)
-                                $("#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
-                                $("#HICMOEntryID").val(LoadData[0].HICMOEntryID); //鐢熶骇璁㈠崟瀛怚D
-                                $("#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 });
-                        }
-                    });
-                console.log($("#HSourceInterID").val());
+                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_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);
+
             });
+
+            //瀹℃牳
+            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); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
-                parent.layer.close(index); //鍐嶆墽琛屽叧闂�
+                Pub_Close(1);
             });
 
 
@@ -697,10 +826,176 @@
 
 
 
+            //楠岃瘉姹囨姤鏁伴噺鏄惁瓒呰繃璁″垝鏁伴噺
+            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.msg(data.Message, { time: 1 * 2000, icon: 1 }, function (index) {
+                                if (data.Verify == "Y") //鑷姩瀹℃牳
+                                {
+                                    layer.close(index);
+                                    SaveVerify(); //瀹℃牳
+                                }
+                                else {
+                                    layer.close(index);
+                                }
+                            });
+                       
+                            //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();//鐢熶骇璁㈠崟涓籌D
+                var HICMOEntryID = $("#HICMOEntryID").val();//鐢熶骇璁㈠崟瀛怚D
+                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();//鐢熶骇璁㈠崟涓籌D
+                var HICMOEntryID = $("#HICMOEntryID").val();//鐢熶骇璁㈠崟瀛怚D
+                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 });
+                    }
+                });
+            }
             //浠ヤ笂涓簂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: "娓╅Θ鎻愮ず" });
@@ -737,13 +1032,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>

--
Gitblit v1.9.1