From d9ccb1dfdb438225014b0b95d642a4e2a0c3736b Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 07 九月 2022 19:43:10 +0800
Subject: [PATCH] 隐藏列 维护 工艺路线 物料id 小写

---
 WebTM/views/生产管理/上料防错单/Sc_Add_MaterToSourceBillList.html |  798 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 438 insertions(+), 360 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\270\212\346\226\231\351\230\262\351\224\231\345\215\225/Sc_Add_MaterToSourceBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\270\212\346\226\231\351\230\262\351\224\231\345\215\225/Sc_Add_MaterToSourceBillList.html"
index 0308984..f26ae2f 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\270\212\346\226\231\351\230\262\351\224\231\345\215\225/Sc_Add_MaterToSourceBillList.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\344\270\212\346\226\231\351\230\262\351\224\231\345\215\225/Sc_Add_MaterToSourceBillList.html"
@@ -99,6 +99,7 @@
                     <form id="form0" class="layui-form" lay-filter="component-form-group" action="">
                         <div class="layui-card-header">
                             <div class="layui-btn-group">
+                                <button type="button" id="Add" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Add">鏂板</button>
                                 <button type="button" id="Saver" 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>
@@ -229,9 +230,9 @@
                                                     <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;">
-                                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" id="HEmpList" style="width:40px;">
+                                                            <input type="text" name="HWorkerName" id="HWorkerName" class="layui-input" value="" style="float:left;width:150px;">
+                                                            <input type="hidden" name="HWorkerID" id="HWorkerID" class="layui-input" value="" style="float:left;width:150px;">
+                                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HWorkerList" id="HEmpList" style="width:40px;">
                                                                 <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                                             </button>
                                                         </div>
@@ -382,7 +383,8 @@
         }).extend({
             index: 'lib/index' //涓诲叆鍙fā鍧�
         }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
-             //#region 鍏敤鍙橀噺
+
+            //#region 鍏敤鍙橀噺
             var $ = layui.$
                 , admin = layui.admin
                 , layer = layui.layer
@@ -395,6 +397,7 @@
             var option2;
             //#endregion
 
+            //#region 杩涘叆椤甸潰鍗冲姞杞�
             //鍒濆鍖栬〃鍗曟彃浠�
             set_InitFrom();
 
@@ -416,289 +419,28 @@
                 layer.alert("鏈煡鎿嶄綔绫诲瀷锛�", { icon: 5 });
             }
 
-            //鍒濆鍖栨彃浠�
-            function set_InitFrom() {
-                //鏃ユ湡鏃堕棿閫夋嫨鍣�
-                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'
-                });
-            }
+            //#endregion
 
-            //鍒濆鍖栬〃鏍�
-            function set_InitGrid() {
-                Table1();  //淇濆吇椤瑰垪琛�
-                Table2();  //閰嶄欢椤瑰垪琛�
+            //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
 
-            }
-
-            //鍒濆鍖栦繚鍏婚」鍒楄〃
-            function Table1() {
-                //琛ㄥご
-                columns = [
-                    { type: 'checkbox', fixed: 'left' }
-                    , { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe" }
-                    , { field: 'HMaterID', title: '鐗╂枡ID', edit: 'text', hide: true }
-                    , { field: 'HNumber', title: '鐗╂枡浠g爜', edit: 'text' }
-                    , { field: 'HName', title: '鐗╂枡鍚嶇О', edit: 'text' }
-                    , { field: 'HModel', title: '瑙勬牸鍨嬪彿', edit: 'text' }
-                    , { field: 'HUnitID', title: '鍗曚綅ID', edit: 'text', hide: true }
-                    , { field: 'HUnitName', title: '鍗曚綅', edit: 'text' }
-                    , { field: 'HModel', title: '瑙勬牸鍨嬪彿', edit: 'text' }
-                    , { field: 'HMQty', title: '閰嶆枡鏁伴噺', edit: 'text' }
-                    , { field: 'HQty', title: '瀹為厤鏁伴噺', edit: 'text' }
-                ];
-                option = {
-                    id: 'mainTable'
-                    , elem: '#mainTable'
-                    , toolbar: '#toolbarDemo'
-                    , defaultToolbar: false  //鏄惁鏄剧ず鍙充晶宸ュ叿鏍�
-                    , page: false
-                    , cellMinWidth: 120
-                    , height: 350
-                    , cols: [columns]
-                    , done: function (res, curr, count) {
-
-                    }
-                };
-            }
-
-            //鍒濆鍖栭厤浠堕」鍒楄〃
-            function Table2() {
-                //琛ㄥご
-                columns1 = [
-                    { type: 'checkbox', fixed: 'left' }
-                    , { templet: '#xuhao1', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe" }
-                    , { field: 'HMouldID', title: '娌诲叿ID', edit: 'text', hide: true}
-                    , { field: 'HMouldNumber', title: '娌诲叿浠g爜', edit: 'text' }
-                    , { field: 'HMouldName', title: '娌诲叿鍚嶇О', edit: 'text' }
-                    , { field: 'HMouldSpec', title: '瑙勬牸鍨嬪彿', edit: 'text' }
-                ];
-                option2 = {
-                    id: 'mainTable1'
-                    , elem: '#mainTable1'
-                    , toolbar: '#toolbarDemo1'
-                    , defaultToolbar: false  //鏄惁鏄剧ず鍙充晶宸ュ叿鏍�
-                    , page: false
-                    , cellMinWidth: 120
-                    , height: 350
-                    , cols: [columns1]
-                    , done: function (res, curr, count) {
-
-                    }
-                };
-            }
-
-            //鏃犳簮鍗曟柊澧�
-            function set_AddFNew()
-            {
-                //鍔犳簮鍗曠被鍨嬪尯鍒�(鍙互鍐欎笉鍚岀殑鏂规硶)
-
-            }
-
-            //鏈夋簮鍗曟柊澧�
-            function set_AddNew() {
-                get_MAXNum();
-                set_SourceAdd();
-                option.data = [];
-                option2.data = [];
-                table.render(option);
-                table.render(option2);
-            }
-
-            //缂栬緫
-            function set_EditFromGrid()
-            {
-                $("#HInterID").val(linterid);//淇敼鏃朵富琛↖D
-                refSav = "Update";
-                $('#HMaterCode').attr("disabled", true);
-                $('#HMaterList').addClass("layui-btn-disabled").attr("disabled", true);
-                $('#HMaterName').attr("disabled", true);
-                $('#HMaterSpec').attr("disabled", true);
-                $('#HBeginDate').attr("disabled", true);
-                $('#HSourceName').attr("disabled", true);
-                $('#HSourceList').addClass("layui-btn-disabled").attr("disabled", true);
-                $('#HMainSourceBillNo').attr("disabled", true);
-                $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
-         
-
-                $('#SourceType').attr("disabled", true);
-                form.render('select');
-                $('#HICMOBillNo').attr("disabled", true);
-
-                $.ajax({
-                    url: GetWEBURL() + "Sc_MESBeginWorkBill/Sc_MESBeginWorkBillListCheckDetai",
-                    type: "GET",
-                    data: {
-                        "HID": linterid
-                    },
-                    success: function (result) {
-
-                        if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                            var data = result.data.h_v_Sc_MESBeginWorkBillList_NEW[0];
-                            form.val("component-form-group", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
-                                "HInterID": data.hmainid
-                                , "HBillNo": data.鍗曟嵁鍙�
-                                , "HDate": formatDate(data.鏃ユ湡)
-                                , "HProcID": data.HProcID
-                                , "HProcName": data.宸ュ簭鍚嶇О
-                                , "HMaterID": data.HMaterID
-                                , "HMaterCode": data.浜у搧浠g爜
-                                , "HMaterName": data.浜у搧鍚嶇О
-                                , "HMaterSpec": data.瑙勬牸鍨嬪彿
-                                , "HBeginDate": data.寮�宸ユ椂闂�
-                                , "HSourceID": data.HSourceID              //璧勬簮ID
-                                , "HSourceName": data.璧勬簮鍚嶇О             //璧勬簮鍚嶇О
-                                , "HEmpID": data.HEmpID                   //鎿嶄綔鍛業D
-                                , "HEmpName": data.鐢宠寮�宸ヤ汉鍛�           //鎿嶄綔鍛�
-                                , "HMainSourceInterID": data.HMainSourceInterID                 //婧愬崟ID
-                                , "HMainSourceEntryID": data.HMainSourceEntryID                 //婧愬崟瀛怚D
-                                , "HMainSourceBillNo": data.HMainSourceBillNo                 //婧愬崟鍗曞彿
-                                , "HMainSourceBillType": data.HMainSourceBillType               //婧愬崟绫诲瀷
-                                , "HGroupID": data.HGroupID                //鐝粍ID
-                                , "HGroupName": data.鐝粍鍚嶇О              //鐝粍鍚嶇О
-
-                                , "HICMOInterID": data.HICMOInterID                       //鐢熶骇璁㈠崟涓籌D
-                                , "HICMOEntryID": data.HICMOEntryID                        //鐢熶骇璁㈠崟瀛怚D
-                                , "HICMOBillNo": data.HICMOBillNo                        //鐢熶骇璁㈠崟
-                                , "HRemark": data.澶囨敞                    //澶囨敞
-                                , "HMaker": data.鍒跺崟浜�                            //鍒跺崟浜�
-                                , "HMakeDate": data.鍒跺崟鏃ユ湡                          //鍒跺崟鏃ユ湡
-                                , "HUpDater": sessionStorage["HUserName"]             //淇敼浜�
-                                , "HUpDateDate": Format(new Date(), "yyyy-MM-dd hh:mm:ss")//淇敼鏃ユ湡
-                                , "HChecker": data.瀹℃牳浜�             //瀹℃牳浜�
-                                , "HCheckDate": data.瀹℃牳鏃ユ湡   //瀹℃牳鏃ユ湡
-                                , "HCloseMan": data.鍏抽棴浜�                //鍏抽棴浜�
-                                , "HCloseDate": data.鍏抽棴鏃ユ湡             //鍏抽棴鏃ユ湡
-                                , "HDeleteMan": data.浣滃簾浜�               //浣滃簾浜�
-                                , "HDeleteDate": data.浣滃簾鏃ユ湡       //浣滃簾鏃ユ湡
-
-                            });
-
-                        } else {
-                            layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
-                        }
-                    }, error: function () {
-                        layer.alert("鍙戠敓閿欒!", { icon: 5 });
-                    }
-                });
-            }
-
-
-            //鏈夋簮鍗曟柊澧�
-            function set_SourceAdd() {
+            //鏂板淇濆瓨
+            form.on('submit(Add)', function (data) {
                 refSav = "Add";
                 //鍒濆鍩烘湰淇℃伅璧嬪��
+                $("#form0")[0].reset();
+                layui.form.render();
+                get_MAXNum();
                 $("#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_MaterToSourceBill/GetMESMaterToSourceFrom", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                        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 get_MAXNum() {
-                //鑾峰彇鏈�澶у崟鎹彿 new
-                $("#HInterID").val("0");
-                $("#HBillNo").val("");
-                $.ajax({
-                    url: GetWEBURL() + "/Web/GetMAXNum",
-                    type: "GET",
-                    data: { "HBillType": '3786' },
-                    success: function (d) {
-                        $("#HBillNo").val(d.data[0].HBillNo);
-                        $("#HInterID").val(0);
-                    }
-                });
-            }
-          
+            });
 
             //淇濆瓨鎻愪氦
             form.on('submit(Saver)', function (data) {
 
                 var sMainStr = JSON.stringify(data.field);
-                var sSubStr = JSON.stringify(table.cache['mainTable']);      
+                var sSubStr = JSON.stringify(table.cache['mainTable']);
                 var sSubStr1 = JSON.stringify(table.cache['mainTable1']);
                 var sMainSub = sMainStr + ';' + sSubStr + ';' + refSav;
 
@@ -716,16 +458,17 @@
                         if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
                             $("#HInterID").val(data.HInterID);//鑾峰彇鎻愪氦鎴愬姛杩斿洖鐨勫崟鎹富ID
                             layer.confirm(data.Message, {
+                                icon: 1,
                                 btn: ['纭']
                             }, function (index) {
-                                    if (data.Verify == "Y") //鑷姩瀹℃牳
-                                    {
-                                        layer.close(index);
-                                        SaveVerify(); //瀹℃牳
-                                    }
-                                    else {
-                                        layer.close(index);
-                                    }
+                                if (data.Verify == "Y") //鑷姩瀹℃牳
+                                {
+                                    layer.close(index);
+                                    SaveVerify(); //瀹℃牳
+                                }
+                                else {
+                                    layer.close(index);
+                                }
                             });
                         }
                         else {
@@ -748,68 +491,6 @@
                 ReVerIfySaver();
             });
 
-            //瀹℃牳鎻愪氦
-            function SaveVerify()
-            {
-                var InterID = $("#HInterID").val();
-                var sSubStr = JSON.stringify(table.cache['mainTable']);
-                var sSubStr1 = JSON.stringify(table.cache['mainTable1']);
-                if (!AllowLoadData(sSubStr, sSubStr1))//鏁版嵁楠岃瘉
-                {
-                    return false;
-                }
-                $.ajax({
-                    type: "GET",
-                    url: GetWEBURL() + "/Sc_MESBeginWorkBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                    async: true,
-                    data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] },
-                    dataType: "json",
-                    success: function (data) {
-                        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 (err) {
-                        layer.alert(err, { icon: 5 })
-                    }
-                })
-            }
-
-            //鍙嶅鏍告彁浜�
-            function ReVerIfySaver() {
-                var InterID = $("#HInterID").val();
-                var sSubStr = JSON.stringify(table.cache['mainTable']);
-                var sSubStr1 = JSON.stringify(table.cache['mainTable1']);
-                if (!AllowLoadData(sSubStr, sSubStr1))//鏁版嵁楠岃瘉
-                {
-                    return false;
-                }
-                $.ajax({
-                    type: "GET",
-                    url: GetWEBURL() + "/Sc_MESBeginWorkBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                    async: true,
-                    data: { "HInterID": InterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] },
-                    dataType: "json",
-                    success: function (data) {
-                        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 (err) {
-                        layer.alert(err, { icon: 5 })
-                    }
-                })
-            }
-
-
             //閫�鍑�
             form.on('submit(Exit)', function (data) {
                 Pub_Close(1);
@@ -830,7 +511,7 @@
                     $.ajax({
                         url: GetWEBURL() + "/Sc_MaterToSourceBill/get_CheckTypeByBarCode_Json",
                         type: "GET",
-                        data: { "HBarCode": HBarCode, "HSourceID": "111", "HICMOInterID": "100030", "HICMOEntryID": "100050"},
+                        data: { "HBarCode": HBarCode, "HSourceID": "111", "HICMOInterID": "100030", "HICMOEntryID": "100050" },
                         success: function (result) {
                             console.info(result);
                             if (result.count == 1) {
@@ -838,33 +519,30 @@
                                     $("#HSourceID").val(result.data.Gy_Source[0].HItemID);
                                     $("#HSourceName").val(result.data.Gy_Source[0].HName);
                                 }
-                                if (result.Verify == '鐢ㄦ枡娓呭崟鐗╂枡鏉$爜')
-                                {
+                                if (result.Verify == '鐢ㄦ枡娓呭崟鐗╂枡鏉$爜') {
                                     //鍥炲啓鐢ㄦ枡娓呭崟鏁版嵁鍒楄〃
                                     // 婧愭暟鎹�
                                     tableBak = table.cache.mainTable;
                                     console.log(tableBak.length);
                                     //鑾峰彇鐗╂枡鏉$爜淇℃伅
-                                    var NewRow = { "HMaterID": result.data[0].HMaterID, "HNumber": result.data[0].HNumber, "HName": result.data[0].HName, "HModel": result.data[0].HModel, "HUnitID": result.data[0].HUnitID, "HUnitName": result.data[0].HUnitName, "HMQty": result.data[0].HMQty, "HQty": result.data[0].HQty };
+                                    var NewRow = { "HBarCode": result.data[0].HBarCode, "HMaterID": result.data[0].HMaterID, "HNumber": result.data[0].HNumber, "HName": result.data[0].HName, "HModel": result.data[0].HModel, "HUnitID": result.data[0].HUnitID, "HUnitName": result.data[0].HUnitName, "HMQty": result.data[0].HMQty, "HQty": result.data[0].HQty };
                                     if (tableBak.length <= 0) {
                                         table.cache["mainTable"].push(NewRow);
                                         option.data = table.cache["mainTable"];
                                         table.render(option);
                                     }
-                                    else
-                                    {
+                                    else {
                                         // 鍘婚噸(涓嶈兘鏈夌浉鍚屾壂鐮佺墿鏂�)
                                         for (var i = 0; i < tableBak.length; i++) {
                                             console.log(tableBak[i].HMaterID, result.data[0].HMaterID);
                                             if (tableBak[i].HMaterID == result.data[0].HMaterID) {
                                                 layer.msg("宸叉壂鎻�,璇峰嬁閲嶅鎵爜锛�", { icon: 0, time: 2000 });
-                                            }
-                                            else {
-                                                table.cache["mainTable"].push(NewRow);
-                                                option.data = table.cache["mainTable"];
-                                                table.render(option);
+                                                return;
                                             }
                                         }
+                                        table.cache["mainTable"].push(NewRow);
+                                        option.data = table.cache["mainTable"];
+                                        table.render(option);
                                     }
                                 }
                             }
@@ -958,7 +636,7 @@
             });
 
             //鎿嶄綔鍛�
-            form.on('submit(HEmpList)', function () {
+            form.on('submit(HWorkerList)', function () {
                 //椤甸潰灞�-鑷畾涔�
                 layer.open({
                     type: 2,
@@ -978,8 +656,8 @@
                         if (checkStatus.data.length === 0) {
                             return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
-                        $("#HEmpName").val(checkStatus.data[0].HName);
-                        $("#HEmpID").val(checkStatus.data[0].HItemID);
+                        $("#HWorkerName").val(checkStatus.data[0].HName);
+                        $("#HWorkerID").val(checkStatus.data[0].HItemID);
                         layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) {
@@ -1079,7 +757,7 @@
                 var AddRow = table.cache['mainTable'];
                 switch (obj.event) {
                     //鍒犻櫎涓�琛�
-                    case 'btn-DeleteLine': btnDeleteLine(checkStatus,data, obj);
+                    case 'btn-DeleteLine': btnDeleteLine(checkStatus, data, obj);
                         break;
                 }
             });
@@ -1096,6 +774,405 @@
                         break;
                 }
             });
+
+            //#endregion
+
+            //#region 鏈〉闈㈡墍鏈夎璋冪敤鐨勬柟娉�
+
+            //鍒濆鍖栨彃浠�
+            function set_InitFrom() {
+                //鏃ユ湡鏃堕棿閫夋嫨鍣�
+                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_InitGrid() {
+                Table1();  //淇濆吇椤瑰垪琛�
+                Table2();  //閰嶄欢椤瑰垪琛�
+
+            }
+
+            //鍒濆鍖栭厤鏂欏垪琛�
+            function Table1() {
+                //琛ㄥご
+                columns = [
+                    { type: 'checkbox', fixed: 'left' }
+                    , { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe" }
+                    , { field: 'HBarCode', title: '鎵弿鏉$爜', edit: 'text', hide: true }
+                    , { field: 'HMaterID', title: '鐗╂枡ID', edit: 'text', hide: true }
+                    , { field: 'HNumber', title: '鐗╂枡浠g爜', edit: 'text' }
+                    , { field: 'HName', title: '鐗╂枡鍚嶇О', edit: 'text' }
+                    , { field: 'HModel', title: '瑙勬牸鍨嬪彿', edit: 'text' }
+                    , { field: 'HUnitID', title: '鍗曚綅ID', edit: 'text', hide: true }
+                    , { field: 'HUnitName', title: '鍗曚綅', edit: 'text' }
+                    , { field: 'HMQty', title: '閰嶆枡鏁伴噺', edit: 'text' }
+                    , { field: 'HQty', title: '瀹為厤鏁伴噺', edit: 'text' }
+                ];
+                option = {
+                    id: 'mainTable'
+                    , elem: '#mainTable'
+                    , toolbar: '#toolbarDemo'
+                    , defaultToolbar: false  //鏄惁鏄剧ず鍙充晶宸ュ叿鏍�
+                    , page: false
+                    , cellMinWidth: 120
+                    , height: 350
+                    , cols: [columns]
+                    , done: function (res, curr, count) {
+
+                    }
+                };
+            }
+
+            //鍒濆鍖栭厤浠堕」鍒楄〃
+            function Table2() {
+                //琛ㄥご
+                columns1 = [
+                    { type: 'checkbox', fixed: 'left' }
+                    , { templet: '#xuhao1', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe" }
+                    , { field: 'HMouldID', title: '娌诲叿ID', edit: 'text', hide: true}
+                    , { field: 'HMouldNumber', title: '娌诲叿浠g爜', edit: 'text' }
+                    , { field: 'HMouldName', title: '娌诲叿鍚嶇О', edit: 'text' }
+                    , { field: 'HMouldSpec', title: '瑙勬牸鍨嬪彿', edit: 'text' }
+                ];
+                option2 = {
+                    id: 'mainTable1'
+                    , elem: '#mainTable1'
+                    , toolbar: '#toolbarDemo1'
+                    , defaultToolbar: false  //鏄惁鏄剧ず鍙充晶宸ュ叿鏍�
+                    , page: false
+                    , cellMinWidth: 120
+                    , height: 350
+                    , cols: [columns1]
+                    , done: function (res, curr, count) {
+
+                    }
+                };
+            }
+
+            //鏃犳簮鍗曟柊澧�
+            function set_AddFNew()
+            {
+               //鍔犳簮鍗曠被鍨嬪尯鍒�(鍙互鍐欎笉鍚岀殑鏂规硶)
+                refSav = "Add";
+                //鍒濆鍩烘湰淇℃伅璧嬪��
+                $("#form0")[0].reset();
+                layui.form.render();
+                get_MAXNum();
+                $("#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"]);     //鍒跺崟浜�
+            }
+
+            //鏈夋簮鍗曟柊澧�
+            function set_AddNew() {
+                get_MAXNum();
+                set_SourceAdd();
+                option.data = [];
+                option2.data = [];
+                table.render(option);
+                table.render(option2);
+            }
+
+            //缂栬緫
+            function set_EditFromGrid()
+            {
+                $("#HInterID").val(linterid);//淇敼鏃朵富琛↖D
+                refSav = "Update";
+                $('#HMaterCode').attr("disabled", true);
+                $('#HMaterList').addClass("layui-btn-disabled").attr("disabled", true);
+                $('#HMaterName').attr("disabled", true);
+                $('#HMaterSpec').attr("disabled", true);
+                $('#HBeginDate').attr("disabled", true);
+                $('#HSourceName').attr("disabled", true);
+                $('#HSourceList').addClass("layui-btn-disabled").attr("disabled", true);
+                $('#HMainSourceBillNo').attr("disabled", true);
+                $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
+         
+
+                $('#SourceType').attr("disabled", true);
+                form.render('select');
+                $('#HICMOBillNo').attr("disabled", true);
+
+                set_EditForm(linterid);  //缂栬緫鑾峰彇琛ㄥご
+                set_EditGrid(linterid);  //缂栬緫鑾峰彇琛ㄤ綋
+               
+            }
+
+            //缂栬緫鑾峰彇琛ㄥご
+            function set_EditForm(linterid) {
+                //鏌ヨ妫�楠屾柟妗堝崟鏄惁瀛樺湪
+                $.ajax({
+                    url: GetWEBURL() + "Sc_MaterToSourceBill/Sc_MaterToSourceBillListCheckDetai",
+                    type: "GET",
+                    data: {
+                        "HID": linterid
+                    },
+                    success: function (result) {
+                        if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            var data = result.data.h_v_Sc_MaterToSourceBillMain[0];
+                            form.val("component-form-group", {
+                                "HInterID": data.hmainid
+                                , "HBillNo": data.鍗曟嵁鍙�
+                                , "HDate": formatDate(data.鏃ユ湡)
+                                , "HPlanQty":"0"
+                                , "HICMOBillNo": data.浠诲姟鍗曞彿
+                                , "HICMOInterID": data.HICMOInterID
+                                , "HICMOEntryID": data.HICMOEntryID
+                                , "HProcExchBillNo": data.宸ュ簭娴佽浆鍗″彿
+                                , "HProcExchQty": ""
+                                , "HSourceInterID": data.HMainSourceInterID
+                                , "HSourceEntryID": data.HMainSourceEntryID
+                                , "HSourceBillNo": data.HMainSourceBillNo
+                                , "HSourceBillType": data.HMainSourceBillType
+                                , "HProcName":""
+                                , "HProcID": "0"
+                                , "HMaterCode": data.浜у搧浠g爜
+                                , "HMaterID": data.HMaterID
+                                , "HMaterName": data.浜у搧鍚嶇О
+                                , "HMaterSpec": data.瑙勬牸鍨嬪彿
+                                , "HSourceID": data.HSourceID
+                                , "HSourceName": data.鐢熶骇璧勬簮
+                                , "HGroupName": data.鐢熶骇鐝粍
+                                , "HGroupID": data.HGroupID
+                                , "HWorkerName": data.鎿嶄綔宸�
+                                , "HWorkerID": data.HWorkerID
+                                , "HMaker": data.鍒跺崟浜�                                            //鍒跺崟浜�
+                                , "HMakeDate": formatDate(data.鍒跺崟鏃ユ湡)                           //鍒跺崟鏃ユ湡
+                                , "HUpDater": sessionStorage["HUserName"]                          //淇敼浜�
+                                , "HUpDateDate": Format(new Date(), "yyyy-MM-dd hh:mm:ss")         //淇敼鏃ユ湡
+                                , "HChecker": data.瀹℃牳浜�                                          //瀹℃牳浜�
+                                , "HCheckDate": formatDate(data.瀹℃牳鏃ユ湡)                          //瀹℃牳鏃ユ湡
+                                , "HCloseMan": data.鍏抽棴浜�                                         //鍏抽棴浜�
+                                , "HCloseDate": formatDate(data.鍏抽棴鏃ユ湡)                          //鍏抽棴鏃ユ湡
+                                , "HDeleteMan": data.浣滃簾浜�                                        //浣滃簾浜�
+                                , "HDeleteDate": formatDate(data.浣滃簾鏃ユ湡)                         //浣滃簾鏃ユ湡
+
+                            });
+
+                        } else {
+                            layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+                        }
+                    }, error: function () {
+                        layer.alert("鍙戠敓閿欒!", { icon: 5 });
+                    }
+                });
+            }
+
+            // 缂栬緫鑾峰彇琛ㄥご鏃舵椂闂存牸寮忕煫姝f柟寮�
+            function formatDate(date) {
+                var d = new Date(date),
+                    month = '' + (d.getMonth() + 1),
+                    day = '' + d.getDate(),
+                    year = d.getFullYear();
+
+                if (month.length < 2) month = '0' + month;
+                if (day.length < 2) day = '0' + day;
+
+                return [year, month, day].join('-');
+            }
+
+            // 缂栬緫鑾峰彇琛ㄤ綋
+            function set_EditGrid(linterid) {
+                $("#HInterID").val(linterid);//淇敼鏃朵富琛↖D
+                //缂栬緫鍔犺浇鏁版嵁
+                $.ajax({
+                    url: GetWEBURL() + 'Sc_MaterToSourceBill/Sc_MaterToSourceBillListProjectDetai',
+                    type: "GET",
+                    data: { "HInterID": linterid },
+                    success: function (result) {
+                        if (result.count == 1) {
+                            option.data = result.list[0];
+                            table.render(option);
+                            option2.data = result.list[1];
+                            table.render(option2);
+
+                        } else {
+                            layer.alert(result.code + result.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.close(index0);
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+
+            //鏈夋簮鍗曟柊澧�
+            function set_SourceAdd() {
+                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_MaterToSourceBill/GetMESMaterToSourceFrom", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        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 get_MAXNum() {
+                //鑾峰彇鏈�澶у崟鎹彿 new
+                $("#HInterID").val("0");
+                $("#HBillNo").val("");
+                $.ajax({
+                    url: GetWEBURL() + "/Web/GetMAXNum",
+                    type: "GET",
+                    data: { "HBillType": '3786' },
+                    success: function (d) {
+                        $("#HBillNo").val(d.data[0].HBillNo);
+                        $("#HInterID").val(0);
+                    }
+                });
+            }
+
+            //瀹℃牳鎻愪氦
+            function SaveVerify()
+            {
+                var InterID = $("#HInterID").val();
+                var sSubStr = JSON.stringify(table.cache['mainTable']);
+                var sSubStr1 = JSON.stringify(table.cache['mainTable1']);
+                if (!AllowLoadData(sSubStr, sSubStr1))//鏁版嵁楠岃瘉
+                {
+                    return false;
+                }
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/Sc_MaterToSourceBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    async: true,
+                    data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] },
+                    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 })
+                    }
+                })
+            }
+
+            //鍙嶅鏍告彁浜�
+            function ReVerIfySaver() {
+                var InterID = $("#HInterID").val();
+                var sSubStr = JSON.stringify(table.cache['mainTable']);
+                var sSubStr1 = JSON.stringify(table.cache['mainTable1']);
+                if (!AllowLoadData(sSubStr, sSubStr1))//鏁版嵁楠岃瘉
+                {
+                    return false;
+                }
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/Sc_MaterToSourceBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    async: true,
+                    data: { "HInterID": InterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] },
+                    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 })
+                    }
+                })
+            }
+
 
             //鍒犻櫎琛�
             function btnDeleteLine(checkStatus,data) {
@@ -1145,6 +1222,7 @@
                 });
             }
 
+            //#endregion
 
             //浠ヤ笂涓簂ayui妯″潡
         });
@@ -1175,7 +1253,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 ($("#HWorkerID").val() == '' || $("#HWorkerID").val() == null) {
                 layer.msg("鎿嶄綔鍛樹笉鑳戒负绌猴紒", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                 return Result = false;
             }

--
Gitblit v1.9.1