From 805a97d1fc54e970a1923792c71ffac88a964792 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 12 四月 2023 21:46:57 +0800
Subject: [PATCH] 数字校验

---
 WebTM/views/生产管理/生产任务单/Sc_ICMOBillEdit_NoTable.html |   25 ++++++++
 WebTM/views/基础资料/公用基础资料/Add_Edit_Gy_Material.html   |  101 +++++++++++++++++++++++++++++++--
 2 files changed, 119 insertions(+), 7 deletions(-)

diff --git "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_Material.html" "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_Material.html"
index 5733ab0..fe78ae2 100644
--- "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_Material.html"
+++ "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Add_Edit_Gy_Material.html"
@@ -106,7 +106,7 @@
                                                 <div class="layui-inline">
                                                     <label class="layui-form-label">鍏嬮噸</label>
                                                     <div class="layui-input-inline" style="">
-                                                        <input class="layui-input" name="HWeight" lay-verify="HWeight" id="HWeight" autocomplete="off" value="0">
+                                                        <input class="layui-input" name="HWeight" lay-verify="HWeight" id="HWeight" placeholder="璇疯緭鍏ユ暟瀛�"  autocomplete="off" value="0">
                                                     </div>
                                                 </div>
                                                 <div class="layui-inline">
@@ -131,13 +131,17 @@
                                                 <div class="layui-inline">
                                                     <label class="layui-form-label">骞呭</label>
                                                     <div class="layui-input-inline" style="">
-                                                        <input class="layui-input" name="HWidth" lay-verify="HWidth" id="HWidth" autocomplete="off" value="0">
+                                                        <input class="layui-input" name="HWidth" lay-verify="HWidth" id="HWidth" placeholder="璇疯緭鍏ユ暟瀛�" autocomplete="off" value="0">
                                                     </div>
                                                 </div>
                                                 <div class="layui-inline">
                                                     <label class="layui-form-label"> 鐗╂枡鍒嗙被锛�</label>
                                                     <div class="layui-input-inline">
-                                                        <input class="layui-input" name="HMaterClsID" lay-verify="HMaterClsID" id="HMaterClsID" autocomplete="off" value="0">
+                                                        <input type="text" readonly name="HMaterClsName" id="HMaterClsName" class="layui-input" value="" style="float: left; width: 100px;">
+                                                        <input type="hidden" name="HMaterClsID" id="HMaterClsID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                        <button type="button" lay-submit="" class="layui-btn" lay-filter="btnHMaterClsID" id="btnHMaterClsID" style="width:40px;">
+                                                            <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                        </button>
                                                     </div>
                                                 </div>
 
@@ -510,6 +514,7 @@
             if (hID == null || hID == 0) {
                 //id new
                 $("#HItemID").val(0);
+                get_ReadConfigFile();
             }
             else {//濡傛灉缂栬緫淇敼鍒欒蛋涓嬮潰
                 $("#HItemID").val(hID);
@@ -598,6 +603,32 @@
             });
 
 
+            //璇诲彇閰嶇疆鏂囦欢
+            function get_ReadConfigFile() {
+                //鑾峰彇鏈湴瀛樺偍鐨勬暟鎹�
+                var data = localStorage.getItem("Add_Edit_Gy_Material");
+                if (data != null) {
+                    var data2 = JSON.parse(data);
+                    $("#HWhID").val(data2["HWhID"]);
+                    $("#HWhName").val(data2["HWhName"]);
+                    $("#HMaterTypeID").val(data2["HMaterTypeID"]);
+                    form.render('select');
+                }
+            }
+
+            //瀛樺偍閰嶇疆鏂囦欢
+            function get_WriteConfigFile() {
+                //娓呯┖鏈湴瀛樺偍鐨勬暟鎹�
+                localStorage.removeItem("Add_Edit_Gy_Material");
+                var data = {
+                    HWhID: $("#HWhID").val()
+                    , HWhName: $("#HWhName").val()
+                    , HMaterTypeID: $("#HMaterTypeID").val()
+                }
+                //鏈湴瀛樺偍
+                localStorage.setItem("Add_Edit_Gy_Material", JSON.stringify(data));
+            }
+
 
             //缂栬緫鐘舵�佹椂锛屾牴鎹唴鐮侊紝鑾峰彇淇℃伅骞跺啓鍏ョ晫闈�
             function RoadBillMain(hID)//鍔犺浇琛ㄥご
@@ -633,7 +664,8 @@
                                 , "HSubjoin": data.闄勫姞灞炴��1
                                 , "HSubjoin2": data.闄勫姞灞炴��2
                                 , "HColor": data.棰滆壊
-                                , "HMaterClsID": data.鐗╂枡鍒嗙被
+                                , "HMaterClsID": data.HMaterClsID
+                                , "HMaterClsName": data.鐗╂枡鍒嗙被
                                 , "HMaterTypeID": data.鐗╂枡灞炴�� == "0" ? 1 : data.鐗╂枡灞炴��
                                 , "HWhID": data.榛樿浠撳簱
                                 , "HWhName": data.浠撳簱鍚嶇О
@@ -701,20 +733,43 @@
                 //var sSubStr = JSON.stringify(table.cache['mainTable']);
                 //var sMainSub = sMainStr + ';' + sSubStr;
                 if ($("#HNumber").val() == 0) {
-                    layer.msg("璇烽�夋嫨鐗╂枡浠g爜锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    layer.msg("璇疯緭鍏ョ墿鏂欎唬鐮侊紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return;
                 }
                 if ($("#HName").val() == 0) {
-                    layer.msg("璇烽�夋嫨鐗╂枡鍚嶇О锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    layer.msg("璇疯緭鍏ョ墿鏂欏悕绉帮紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return;
                 }
                 if ($("#HModel").val() == 0) {
-                    layer.msg("璇烽�夋嫨瑙勬牸鍨嬪彿锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    layer.msg("璇疯緭鍏ヨ鏍煎瀷鍙凤紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return;
                 }
                 if ($("#HUnitName").val() == 0) {
                     layer.msg("璇烽�夋嫨涓昏閲忓崟浣嶏紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return;
+                }
+                var HWeight = $('#HWeight').val();
+                if (HWeight.substring(HWeight.length - 1, HWeight.length) == ".") {
+                    layer.msg("鍏嬮噸鐨勭粨灏句笉鑳芥槸.锛�");
+                    return;
+                } else {
+                    var ref = /^[0-9]+\.?[0-9]*$/;
+                    if (!ref.test(HWeight)) {
+                        layer.msg("鍏嬮噸璇疯緭姝g‘鍏ユ暟瀛楋紒");
+                        return;
+                    }
+                }
+
+                var HWidth = $('#HWidth').val();
+                if (HWidth.substring(HWidth.length - 1, HWidth.length) == ".") {
+                    layer.msg("骞呭鐨勭粨灏句笉鑳芥槸.锛�");
+                    return;
+                } else {
+                    var ref = /^[0-9]+\.?[0-9]*$/;
+                    if (!ref.test(HWidth)) {
+                        layer.msg("骞呭璇疯緭姝g‘鍏ユ暟瀛楋紒");
+                        return;
+                    }
                 }
                 //if ($("#HUnitGroupName").val() == 0) {
                 //    layer.msg("璇烽�夋嫨璁¢噺鍗曚綅缁勶紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
@@ -748,6 +803,7 @@
                             if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
                                 layer.msg(data.Message, { icon: 1 });
                                 $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
+                                get_WriteConfigFile();
                             }
                             else {
 
@@ -812,6 +868,37 @@
                     , btn2: function (index, layero) { }
                 })
             });
+
+            //閫夋嫨鐗╂枡鍒嗙被
+            form.on('submit(btnHMaterClsID)', function () {
+                layer.open({
+                    type: 2
+                    , area: ['90%', '90%']//澶у皬
+                    , title: '鐗╂枡鍒嗙被鍒楄〃'
+                    , shade: 0.6 //閬僵閫忔槑搴�
+                    , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
+                    , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+                    , content: ['../../../views/鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_MaterType.html', 'yes']
+                    , resize: false
+                    , cancel: function () {
+                        //$(".layui-btn").removeClass("layui-btn-disabled");
+                    }
+                    , btn: ['纭畾', '鍙栨秷']
+                    , btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                        if (checkStatus.data.length != 1) {
+                            return layer.msg('璇烽�夋嫨涓�鏉℃暟鎹�');
+                        }
+                        $("#HMaterClsName").val(checkStatus.data[0].鍚嶇О);
+                        $("#HMaterClsID").val(checkStatus.data[0].HItemID);
+                        layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) { }
+                })
+            });
+
+
             //閫夋嫨杈呭姪璁¢噺鍗曚綅
             form.on('submit(HSecUnitList)', function () {//閫夋嫨瀹胯垗
                 $("#UnitType").val(2);
diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillEdit_NoTable.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillEdit_NoTable.html"
index d872424..ddcb0b8 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillEdit_NoTable.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillEdit_NoTable.html"
@@ -1236,6 +1236,31 @@
                     return false;
                 }
 
+
+                var HQty = $('#HQty').val();
+                if (HQty.substring(HQty.length - 1, HQty.length) == ".") {
+                    layer.msg("璁″垝鐢熶骇鏁伴噺鐨勭粨灏句笉鑳芥槸.锛�");
+                    return;
+                } else {
+                    var ref = /^[0-9]+\.?[0-9]*$/;
+                    if (!ref.test(HQty)) {
+                        layer.msg("璁″垝鐢熶骇鏁伴噺璇疯緭姝g‘鍏ユ暟瀛楋紒");
+                        return;
+                    }
+                }
+
+                var HAuxQty = $('#HAuxQty').val();
+                if (HAuxQty.substring(HAuxQty.length - 1, HAuxQty.length) == ".") {
+                    layer.msg("杈呮暟閲忕殑缁撳熬涓嶈兘鏄�.锛�");
+                    return;
+                } else {
+                    var ref = /^[0-9]+\.?[0-9]*$/;
+                    if (!ref.test(HAuxQty)) {
+                        layer.msg("杈呮暟閲忚杈撴纭叆鏁板瓧锛�");
+                        return;
+                    }
+                }
+
                 //if ($("#HDeptName").val() == "") {
                 //    layer.msg("鐢熶骇杞﹂棿娌℃湁閫夋嫨");
                 //    return false;

--
Gitblit v1.9.1