From e6e2e89ee594f3ffcd8512113bb2ab4ce57f37bb Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期二, 24 十二月 2024 10:13:31 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI

---
 WebTM/views/生产管理/生产计划平台/JIT_DayPlanPlatFormImport.html |  161 +++++++++++++++++++++++++++++------------------------
 1 files changed, 89 insertions(+), 72 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatFormImport.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatFormImport.html"
index 5042bcf..4213fbc 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatFormImport.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatFormImport.html"
@@ -11,37 +11,6 @@
     <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
     <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
     <script src="../../../layuiadmin/PubCustom.js"></script>
-    <style>
-        .main-btn { /*澶撮儴涓绘寜閽�*/
-            padding: 0 2px; /*璋冩暣鎸夐挳宸﹀彸绌洪殭澶у皬*/
-            height: 30px;
-            line-height: 30px;
-        }
-
-        .btn-title {
-            font-size: 16px;
-        }
-        /* 闃叉涓嬫媺妗嗙殑涓嬫媺鍒楄〃琚殣钘�---蹇呴』璁剧疆--- */
-        .layui-table-cell {
-            overflow: visible !important;
-        }
-        /* 浣垮緱涓嬫媺妗嗕笌鍗曞厓鏍煎垰濂藉悎閫� */
-        td .layui-form-select {
-            margin-top: -10px;
-            margin-left: -15px;
-            margin-right: -15px;
-        }
-
-        .layui-form-item .layui-inline {
-            margin-top: 5px;
-            margin-bottom: 5px;
-            margin-right: 0px;
-        }
-
-        .layui-form-label {
-            width: 25%;
-        }
-    </style>
 </head>
 <body>
     <div class="layui-fluid" style="padding: 0;">
@@ -213,40 +182,63 @@
             var dd = myDate.getDate();
             var SumMonth = 31; //鍔ㄦ�佷袱鏈堜箣宸� new Date(yyyy, MM, 0).getDate()
             var columns = [];
+            var HBEGINDATE = new Date(new Date($("#HDate").val())).getDate(); //鑾峰彇寮�濮嬫棩鏈熷ぉ鏁�
 
             columns.push({ type: 'checkbox', fixed: 'left' });
             columns.push({ field: 'hmainid', title: 'hmainid', width: 200, hide: true });
             columns.push({ field: '鍗曟嵁鍙�', title: '鍗曟嵁鍙�', width: 200 });
-            columns.push({ field: '鐢熶骇璁㈠崟鍙�*', title: '鐢熶骇璁㈠崟鍙�' });
+            columns.push({ field: '鐢熶骇璁㈠崟鍙�*', title: '鐢熶骇璁㈠崟鍙�', width: 150 });
             columns.push({ field: '鐢熶骇璁㈠崟鏄庣粏琛屽彿*', title: '鐢熶骇璁㈠崟鏄庣粏琛屽彿', width: 200 });
-            columns.push({ field: '缁勭粐缂栫爜*', title: '缁勭粐缂栫爜' });
+            columns.push({ field: '缁勭粐缂栫爜*', title: '缁勭粐缂栫爜', width: 150});
             columns.push({ field: 'HWorkShopID', title: 'HWorkShopID', hide: true });
-            columns.push({ field: '鐢熶骇杞﹂棿缂栫爜*', title: '鐢熶骇杞﹂棿' });
+            columns.push({ field: '鐢熶骇杞﹂棿缂栫爜*', title: '鐢熶骇杞﹂棿', width: 150});
             columns.push({ field: 'HSourceID', title: 'HSourceID', hide: true });
             columns.push({ field: '鐢熶骇璧勬簮缂栫爜*', title: '鐢熶骇璧勬簮', edit: 'text', event: "HSourceID"   });
             columns.push({ field: '浼樺厛绾�', title: '浼樺厛绾�' });
             columns.push({ field: 'HEmpID', title: 'HEmpID', hide: true });
-            columns.push({ field: '鍛樺伐', title: '鍛樺伐' });
-            columns.push({ field: '鍛樺伐缂栫爜', title: '鍛樺伐缂栫爜' });
+            columns.push({ field: '鍛樺伐', title: '鍛樺伐', width: 150 });
+            columns.push({ field: '鍛樺伐缂栫爜', title: '鍛樺伐缂栫爜', width: 150 });
             columns.push({ field: 'HMaterID', title: '鐗╂枡ID', hide: true });
-            columns.push({ field: '鐗╂枡缂栫爜*', title: '鐗╂枡缂栫爜' });
+            columns.push({ field: '鐗╂枡缂栫爜*', title: '鐗╂枡缂栫爜', width: 150 });
             columns.push({ field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 200 });
-            columns.push({ field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿' });
+            columns.push({ field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 150});
             columns.push({ field: 'HUnitID', title: 'HUnitID', hide: true });
-            columns.push({ field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅' });
-            columns.push({ field: '鎵规鍙�', title: '鎵规' });
+            columns.push({ field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 150});
+            columns.push({ field: '鎵规鍙�', title: '鎵规', width: 150});
             columns.push({ field: '閿�鍞鍗曟暟閲�', title: '閿�鍞鍗曟暟閲�', width: 200 });
             columns.push({ field: '鐢熶骇璁㈠崟鏁伴噺', title: '鐢熶骇璁㈠崟鏁伴噺', width: 200 });
             columns.push({ field: '鎬婚綈濂楁暟閲�', title: '鎬婚綈濂楁暟閲�', width: 200 });
             columns.push({ field: 'ICMOBillHInterID', title: 'ICMOBillHInterID', hide: true});
             columns.push({ field: 'ICMOBillHEntryID', title: 'ICMOBillHEntryID', hide: true });
             columns.push({ field: 'HProdORGID', title: 'HProdORGID', hide: true });
-            for (var i = 0; i <= (SumMonth - dd); i++) {
-                columns.push({ field: Format(yyyy + '/' + MM + '/' + (dd + i), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (dd + i), 'MM.dd'), edit: 'text', width:60 })
+
+            var k = 0;//鏀堕泦寰幆娆℃暟
+            var Days = 45;
+            for (var j = 0; j <= (Days - k); j++) {
+                columns.push({ field: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'MM.dd'), width: 70, totalRow: true })
+                //璺ㄥ勾鐨勮瘽 浼氫粠涓�鏈堜竴鍙峰紑濮�
+                if (MM == 12 && (HBEGINDATE + j) == 31) {
+                    yyyy += 1;
+                    MM = 1;
+                    SumMonth = new Date(yyyy, MM, 0).getDate();
+                    HBEGINDATE = 0;
+                    k += j;
+                    j = 0;
+                } else if ((HBEGINDATE + j) == SumMonth) { //璺ㄦ湀 鏈堟暟鍔犱竴  澶╂暟浠庝竴寮�濮�
+                    HBEGINDATE = 0;
+                    MM += 1;
+                    SumMonth = new Date(yyyy, MM, 0).getDate();
+                    k += j;
+                    j = 0;
+                }
             }
-            for (var i = 1; i <= dd; i++) {
-                columns.push({ field: Format(yyyy + '/' + (MM + 1) + '/' + i, 'yyyy-MM-dd'), title: Format(yyyy + '/' + (MM + 1) + '/' + i, 'MM.dd'), edit: 'text', width: 60 })
-            }
+
+            //for (var i = 0; i <= (SumMonth - dd); i++) {
+            //    columns.push({ field: Format(yyyy + '/' + MM + '/' + (dd + i), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (dd + i), 'MM.dd'), edit: 'text', width:80 })
+            //}
+            //for (var i = 1; i <= dd; i++) {
+            //    columns.push({ field: Format(yyyy + '/' + (MM + 1) + '/' + i, 'yyyy-MM-dd'), title: Format(yyyy + '/' + (MM + 1) + '/' + i, 'MM.dd'), edit: 'text', width: 80 })
+            //}
             columns.push({ fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo' });
 
             option = {
@@ -263,7 +255,7 @@
 
             //娓叉煋椤甸潰
             table.render(option);
-        }
+        }      
 
         //瀵煎叆(淇濆瓨)
         function set_AddNew(data) {
@@ -272,36 +264,61 @@
             for (var i = 0; i < table.cache["mainTable"].length; i++) {
                 if (table.cache["mainTable"][i] != "") {
                     table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
+
+                    if (table.cache["mainTable"][i].鐗╂枡鍚嶇О.indexOf("\"") != -1 || table.cache["mainTable"][i].鐗╂枡鍚嶇О.indexOf(";") != -1) {
+                        table.cache["mainTable"][i].鐗╂枡鍚嶇О = table.cache["mainTable"][i].鐗╂枡鍚嶇О.replaceAll("\"", "鈥�").replaceAll(";", "锛�")
+                    }
+                    if (table.cache["mainTable"][i].瑙勬牸鍨嬪彿.indexOf("\"") != -1 || table.cache["mainTable"][i].瑙勬牸鍨嬪彿.indexOf(";") != -1) {
+                        table.cache["mainTable"][i].瑙勬牸鍨嬪彿 = table.cache["mainTable"][i].瑙勬牸鍨嬪彿.replaceAll("\"", "鈥�").replaceAll(";", "锛�")
+                    }
+
                     num.push(table.cache["mainTable"][i])
                 }
             }
-            data.field.HPRDORGID = sessionStorage["OrganizationID"];//缁勭粐
-            var sMainStr = JSON.stringify(data.field);
-            var sSubStr = JSON.stringify(num);
-            var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
-            var index = layer.load();
-           
-            $.ajax({
-                type: "POST",
-                url: GetWEBURL() + "/JIT_DayPlanPlatFormImport/JIT_DayPlanPlatFormImport_btnSave",
-                async: true,
-                data: { "sMainSub": sMainSub },
-                dataType: "json",
-                success: function (data) {
-                    if (data.count == 1) {
-                        layer.close(index);
-                        layer.msg("鎻愪氦鎴愬姛");
-                    }
-                    else {
-                        layer.close(index);
-                        layer.msg(data.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                    }
-                },
-                error: function (err) {
-                    layer.close(index);
-                    layer.msg("閿欒:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+
+            for (var i = 0; i < option.data.length; i++) {
+                if (option.data[i].鐗╂枡鍚嶇О.indexOf("\"") != -1 || option.data[i].鐗╂枡鍚嶇О.indexOf(";") != -1) {
+                    option.data[i].鐗╂枡鍚嶇О = option.data[i].鐗╂枡鍚嶇О.replaceAll("\"", "鈥�").replaceAll(";", "锛�")
                 }
-            });
+                if (option.data[i].瑙勬牸鍨嬪彿.indexOf("\"") != -1 || option.data[i].瑙勬牸鍨嬪彿.indexOf(";") != -1) {
+                    option.data[i].瑙勬牸鍨嬪彿 = option.data[i].瑙勬牸鍨嬪彿.replaceAll("\"", "鈥�").replaceAll(";", "锛�")
+                }
+            }
+
+            var HDataSub = [];
+
+            //JIT瀵煎叆璁″垝锛屾瘡娆″鍏�100琛屾暟鎹�,鍙慨鏀筰鐨勮嚜澧炲�煎喅瀹氭瘡娆″惊鐜鍏ョ殑琛屾暟
+            for (var i = 0; i < option.data.length; i += 100) {
+                HDataSub = option.data.slice(i, i + 100)
+
+                data.field.HPRDORGID = sessionStorage["OrganizationID"];//缁勭粐
+                var sMainStr = JSON.stringify(data.field);
+                var sSubStr = JSON.stringify(HDataSub);
+                var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
+                var index = layer.load();
+
+                $.ajax({
+                    type: "POST",
+                    url: GetWEBURL() + "/JIT_DayPlanPlatFormImport/JIT_DayPlanPlatFormImport_btnSave",
+                    async: false,
+                    data: { "sMainSub": sMainSub },
+                    dataType: "json",
+                    success: function (data) {
+                        if (data.count == 1) {
+                            layer.close(index);
+                            layer.msg("鎻愪氦鎴愬姛");
+                        }
+                        else {
+                            layer.close(index);
+                            layer.msg(data.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        }
+                    },
+                    error: function (err) {
+                        layer.close(index);
+                        layer.msg("閿欒:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    }
+                });
+            }            
         }
 
         //琛屽唴鍒犻櫎

--
Gitblit v1.9.1