From 8fa6f2d3686c60088980f2a41b3cc6b64a09ae31 Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期四, 04 十一月 2021 16:49:12 +0800
Subject: [PATCH] 器具管理所有出入库明细加计量单位显示并保存

---
 WebAPI/Controllers/WebAPIController.cs |   86 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 74 insertions(+), 12 deletions(-)

diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 73c88c0..ab01574 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -1,6 +1,8 @@
 锘縰sing DAL;
 using DBUtility;
 using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
 using Newtonsoft.Json.Linq;
 using SQLHelper;
 using System;
@@ -81,10 +83,11 @@
         /// </summary>
         /// <param name="UserName">鐢ㄦ埛鍚�</param>
         /// <param name="PassWord">瀵嗙爜</param>
+        /// <param name="PassWord">缁勭粐</param>
         /// <returns></returns>
         [Route("Web/GetUser")]
         [HttpGet]
-        public object GetUser(string UserName, string PassWord)
+        public object GetUser(string UserName, string PassWord, string HOrgName)
         {
             try
             {
@@ -100,14 +103,24 @@
                     objjson.data = null;
                     return objjson;
                 }
-                else
+                string sql = string.Format(@" select a.* from Gy_UserByOrgRelation a
+                                              where a.HUserID = '{0}' and a.HOrgID = '{1}'", UserName, HOrgName);
+                DataSet _ds = oCnLoc.RunProcReturn(sql, "h_p_Xt_UserRelationOrg_Check");
+                if (_ds == null || _ds.Tables[0].Rows.Count == 0)
                 {
                     objjson.code = "0";
-                    objjson.count = 1;
-                    objjson.Message = "鐧诲綍鎴愬姛锛�";
-                    objjson.data = ds.Tables[0];
+                    objjson.count = 0;
+                    objjson.Message = "鐢ㄦ埛" + UserName + "娌℃湁璇ョ粍缁囨潈闄�";
+                    objjson.data = null;
                     return objjson;
                 }
+
+                objjson.code = "0";
+                objjson.count = 1;
+                objjson.Message = "鐧诲綍鎴愬姛锛�";
+                objjson.data = ds.Tables[0];
+                return objjson;
+
             }
             catch (Exception)
             {
@@ -1279,7 +1292,7 @@
         {
             //sWhere = " Where HStopFlag=0  and HEndFlag=1";
             //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
-            if (BadReason != ""&& BadReason != null)
+            if (BadReason != "" && BadReason != null)
             {
                 sWhere = sWhere + " and ( HNumber like '%" + BadReason + "%' or HName like '%" + BadReason + "%' ) ";
             }
@@ -1735,9 +1748,9 @@
                 sWhere = " Where HStopFlag=0  and HEndFlag=1";
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
-                if (CheckItem != ""&& CheckItem!=null)
+                if (CheckItem != "" && CheckItem != null)
                 {
-                    sWhere = sWhere + " and ( HNumber like '%" + CheckItem + "%' or HName like '%" + CheckItem + "%' ) ";  
+                    sWhere = sWhere + " and ( HNumber like '%" + CheckItem + "%' or HName like '%" + CheckItem + "%' ) ";
                     ds = oCN.RunProcReturn("Select HItemID,HNumber,HName  from Gy_DotCheck " + sWhere + " Order by HItemID ", "Gy_DotCheck");
                 }
                 else
@@ -1780,7 +1793,7 @@
         /// <returns></returns>
         [Route("Web/GetSc_ICMOBillListView")]
         [HttpGet]
-        public object GetSc_ICMOBillListView(string ICMOBill,int OrganizationID)
+        public object GetSc_ICMOBillListView(string ICMOBill, int OrganizationID)
         {
             if (ICMOBill != "")
             {
@@ -1795,7 +1808,7 @@
                 }
                 else
                 {
-                    string sql = "select * from h_v_IF_ICMOBillList "+ sWhere+ " and isnull(瀹℃牳浜�,'')<>'' and isnull(鍏抽棴浜�,'')='' and isnull(琛屽叧闂汉,'')=''  order by 鍗曟嵁鍙� desc,hsubid ";
+                    string sql = "select * from h_v_IF_ICMOBillList " + sWhere + " and isnull(瀹℃牳浜�,'')<>'' and isnull(鍏抽棴浜�,'')='' and isnull(琛屽叧闂汉,'')=''  order by 鍗曟嵁鍙� desc,hsubid ";
                     ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOBillList");
                 }
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
@@ -1935,7 +1948,7 @@
         /// <returns></returns>
         [Route("Web/GetGy_QCCheckItem")]
         [HttpGet]
-        public object GetGy_QCCheckItem(string CheckItem,int OrganizationID)
+        public object GetGy_QCCheckItem(string CheckItem, int OrganizationID)
         {
             if (CheckItem != "")
             {
@@ -2130,7 +2143,7 @@
         /// <returns></returns>
         [Route("Web/GetWMSBarCodeDetailsList")]
         [HttpGet]
-        public object GetWMSBarCodeDetailsList(int HInterID,string HBillType)
+        public object GetWMSBarCodeDetailsList(int HInterID, string HBillType)
         {
             try
             {
@@ -2195,6 +2208,55 @@
             }
         }
 
+
+        #region [鏌ヨ鑿滃崟鍒楄〃]
+        [Route("Web/MenuList")]
+        [HttpGet]
+        public object MenuList()
+        {
+            try
+            {
+                List<Menu> mu = new List<Menu>();
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                ds = oCn.RunProcReturn("Select * from Gy_Menu Order by HItemID ", "Gy_Menu");
+                //List<Menu> mu1 = ds.Tables[0].AsEnumerable().Select(t => new Menu()).ToList();
+                //List<Menu> users = ModelConvertHelper<Menu>.ConvertToModel(ds.Tables[0]);
+                //var dd = ToHierarchy.ToHierarchyList(users);
+                //string json = JsonConvert.SerializeObject(dd);
+                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)   //杩欓噷鏄惊鐜墍鏈�
+                {
+                    if (ds.Tables[0].Rows[i]["HPartentID"].ToString() == "0" || ds.Tables[0].Rows[i]["HitemID"].ToString() == ds.Tables[0].Rows[i]["HPartentID"].ToString())  //鍒ゆ柇鏄惁鏈�澶栧眰鏍硅妭鐐�
+                    {
+                        Menu tbj = new Menu();
+                        tbj.HitemID = ds.Tables[0].Rows[i]["HitemID"].ToString();
+                        tbj.HNumber = ds.Tables[0].Rows[i]["HNumber"].ToString();
+                        tbj.HName = ds.Tables[0].Rows[i]["HName"].ToString();
+                        tbj.HPartentID = ds.Tables[0].Rows[i]["HPartentID"].ToString();
+                        tbj.HLevel = int.Parse(ds.Tables[0].Rows[i]["HLevel"].ToString());
+                        tbj.Hurl = ds.Tables[0].Rows[i]["Hurl"].ToString();
+                        mu.Add(tbj);
+                    }
+                }
+                ToHierarchy.digui(ds.Tables[0], mu);
+
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(mu);
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�";
+                objJsonResult.data = e.ToString();
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 
 }

--
Gitblit v1.9.1