姜永辉 пре 5 месеци
родитељ
комит
e5542d3966

+ 38 - 0
wwwroot/mes/mst/holiday/getHolidayYear.ashx

@@ -0,0 +1,38 @@
+<%@ WebHandler Language="C#" Class="getHolidayYear" %>
+ 
+using System.Web;
+using System.Web.SessionState;
+using System.Data; 
+using Curtain.DataAccess;
+using DK.XuWei.WebMes;
+
+public class getHolidayYear : IHttpHandler, IReadOnlySessionState
+{
+    public void ProcessRequest(HttpContext context)
+    {
+        context.Response.ContentType = "text/plain";
+        using(IDataAccess conn = DataAccess.Create())
+        {
+           DataTable dt = conn.ExecuteDatatable(@"
+                                SELECT 
+                                TO_NUMBER(LEVEL + 2000) AS ID,
+                                TO_CHAR(LEVEL + 2000) AS TEXT  -- 直接转换为字符串,无需多余拼接
+                            FROM 
+                                DUAL
+                            CONNECT BY 
+                                LEVEL <= 100  " );
+
+            context.Response.Write(dt.ToJson());
+        }
+
+    }
+
+    public bool IsReusable
+    {
+        get
+        {
+            return false;
+        }
+    }
+
+}

+ 22 - 16
wwwroot/mes/mst/holiday/holiday_add.html

@@ -10,8 +10,8 @@
 </head>
 <body class="easyui-layout">
     <form id="ff" method="post" class="w-form">
-        <div data-options="region:'north',plain:true,border:false,split:true,title:'选取年份'" style="width: 100%; height: 72px;">
-            <input id="dateMaster" name="dateMaster" class="easyui-datebox" style="width:180px;" data-options="formatter:yearFormatter, parser:yearParser,editable:false">
+        <div data-options="region:'north',plain:true,border:false,split:true,title:'选取年份'" style="width: 100%; height: 72px;"> 
+            <input class="easyui-combobox" id="dateMaster" name="dateMaster" data-options="required:false,prompt:'年份',tipPosition:'top',url:'getHolidayYear.ashx',method:'get',valueField:'ID',textField:'TEXT',panelHeight:'200px',editable:false" style="width:140px;height:32px;">
         </div>
         <div data-options="region:'west',plain:true,border:false,split:true,title:'节假日(用逗号分开)'" style="width:50%">
             <div class="w-div">
@@ -52,14 +52,13 @@
                 url: 'holiday.ashx?m=a'
             });
             $('#more1').toggle();
-            var ctime = new Date();
-            var beginDate = ctime.getFullYear() + "-" + (ctime.getMonth() + 1) + "-" + ctime.getDate()
-            $("#dateMaster").datebox("setValue", beginDate);
+            var ctime = new Date(); 
+            $("#dateMaster").combobox("setValue", ctime.getFullYear());
             loadinit();
         });
 
         function submitForm() {
-            var year = $("#dateMaster").datebox("getValue");
+            var year = $("#dateMaster").combobox("getValue");
             if ($("#holidayProductDate").textbox("getText") == null || $("#holidayProductDate").textbox("getText") == "") {
                 $.messager.alert('提示', '请选择节假日日期', 'warning');
                 return;
@@ -98,14 +97,21 @@
         }
 
         function yearParser(s) {
-            if (!s) return new Date();
-            var y = s;
-            var date;
-            if (!isNaN(y)) {
-                return new Date(y, 0, 1);
-            } else {
-                return new Date();
-            }
+            //if (!s) return new Date();
+            //var y = s;
+            //var date;
+            //if (!isNaN(y)) {
+            //    return new Date(y, 0, 1);
+            //} else {
+            //    return new Date();
+            //}
+           
+            if (!s) {
+                var year = new Date().getFullYear;
+                return new Date(parseInt(year, 10), 0, 1); // 只解析年份
+            };
+            var year = s.substring(0, 4);
+            return new Date(parseInt(year, 10), 0, 1); // 只解析年份
         };
 
         function cancelForm() {
@@ -127,7 +133,7 @@
                     var m = date.getMonth() + 1;
                     var d = date.getDate();
 
-                    var year = $("#dateMaster").datebox("getValue");
+                    var year = $("#dateMaster").combobox("getValue");
                     if (year != y) {
                         $.messager.alert('提示', '请选择该年份的节假日日期', 'warning');
                     } else {
@@ -179,7 +185,7 @@
                     var m = date.getMonth() + 1;
                     var d = date.getDate();
 
-                    var year = $("#dateMaster").datebox("getValue");
+                    var year = $("#dateMaster").combobox("getValue");
                     if (year != y) {
                         $.messager.alert('提示', '请选择该年份的串休日期', 'warning');
                     } else {

+ 22 - 0
wwwroot/mes/rpt/rpt.ashx

@@ -578,6 +578,28 @@ public class rpt : IHttpHandler, IReadOnlySessionState
                         }
                         break;
                     }
+                 case "getHolidayYear":
+                    {
+                        //获取成型线楼号 全部
+                        using (IDataAccess conn = DataAccess.Create())
+                        {
+                            DataTable dt = conn.ExecuteDatatable(@"
+                                SELECT 
+                                    LEVEL + 2000 as HOLIDAYYEAR
+                                FROM 
+                                    DUAL
+                                CONNECT BY 
+                                    LEVEL <= 100;
+                            " );
+
+                           if (context.Request["select"] is object)
+                                context.Response.Write(dt.ToJson());
+                            else
+                                context.Response.Write(new JsonResult(dt).ToJson());
+                               
+                        }
+                        break;
+                    }
                 case "getLogo":
                     {
                         //获取商标 全部