فهرست منبع

添加接口JLH_FetchPrice

shuiping150 3 هفته پیش
والد
کامیت
954503f70c
4فایلهای تغییر یافته به همراه74 افزوده شده و 0 حذف شده
  1. 26 0
      JLHHJSvr/Com/JLH_FetchPrice.cs
  2. 44 0
      JLHHJSvr/Excutor/JLH_FetchPriceExcutor.cs
  3. 2 0
      JLHHJSvr/GlobalVar/GlobalVar.cs
  4. 2 0
      JLHHJSvr/JLHHJSvr.csproj

+ 26 - 0
JLHHJSvr/Com/JLH_FetchPrice.cs

@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    /// <summary>
+    /// 获取所有材料价
+    /// </summary>
+    public sealed class JLH_FetchPriceRequest: ILJRequest<JLH_FetchPriceResponse>
+    {
+        public string token { get; set; }
+        public override string GetApiName()
+        {
+            return "JLH_FetchPrice";
+        }
+    }
+
+    public sealed class JLH_FetchPriceResponse : LJResponse
+    {
+        /// <summary>
+        /// 只有mtrlcode与price内容
+        /// </summary>
+        public List<u_configure_codemx> list { get; set; }
+    }
+}

+ 44 - 0
JLHHJSvr/Excutor/JLH_FetchPriceExcutor.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Server;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class JLH_FetchPriceExcutor:ExcutorBase<JLH_FetchPriceRequest, JLH_FetchPriceResponse>
+    {
+        protected override void ExcuteInternal(JLH_FetchPriceRequest request, object state, JLH_FetchPriceResponse rslt)
+        {
+            if (request.token != "7DEA6FF3-3E81-4EDA-8A02-1F56073A45FD")
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+
+            using (var con = new SqlConnection(GlobalVar.ConnectionString))
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                rslt.list = new List<u_configure_codemx>();
+
+                cmd.CommandText = "SELECT '' AS mtrlcode, 123 AS price";
+                cmd.Parameters.Clear();
+
+                using (var reader = cmd.ExecuteReader())
+                {
+                    while (reader.Read())
+                    {
+                        rslt.list.Add(new u_configure_codemx()
+                        {
+                            mtrlcode = Convert.ToString(reader["mtrlcode"]).Trim(),
+                            price = Convert.ToDecimal(reader["price"]),
+                        });
+                    }
+                }
+            }
+        }
+    }
+}

+ 2 - 0
JLHHJSvr/GlobalVar/GlobalVar.cs

@@ -233,6 +233,8 @@ namespace JLHHJSvr
 
                 excutorManager.AddMap("GetFormulaVarList",typeof(GetFormulaVarListRequest),new GetFormulaVarListExcutor());
                 excutorManager.AddMap("FormulaCheck", typeof(FormulaCheckRequest),new FormulaCheckExcutor());
+
+                excutorManager.AddMap("JLH_FetchPrice", typeof(JLH_FetchPriceRequest), new JLH_FetchPriceExcutor());
             }
             catch (Exception ex)
             {

+ 2 - 0
JLHHJSvr/JLHHJSvr.csproj

@@ -102,6 +102,7 @@
     <Compile Include="Com\CreatPrdPf.cs" />
     <Compile Include="Com\DeleteMattressExtraType.cs" />
     <Compile Include="Com\DeleteMattressExtra.cs" />
+    <Compile Include="Com\JLH_FetchPrice.cs" />
     <Compile Include="Com\Model\replacement_bednet.cs" />
     <Compile Include="Com\FormulaCheck.cs" />
     <Compile Include="Com\GetFormulaVarList.cs" />
@@ -297,6 +298,7 @@
     <Compile Include="Excutor\DeleteMattressExtraExcutor.cs" />
     <Compile Include="Excutor\FormulaCheckExcutor.cs" />
     <Compile Include="Excutor\GetFormulaVarListExcutor.cs" />
+    <Compile Include="Excutor\JLH_FetchPriceExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraTypeExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraExcutor.cs" />
     <Compile Include="Excutor\UnLockUserExcutor.cs" />