yusijie
2022-11-29 ad6942e580b2f5391244401a02bdbad04ec96d9b
WebAPI/Controllers/BaseSet/Gy_UnitController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -31,6 +32,7 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_UnitGroup", 1, false, user))
                {
@@ -44,19 +46,28 @@
                string sql1 = string.Format(@"select * from h_v_Gy_UnitList where 禁用标记='' and 组织名称='" + Organization + "'");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn(sql1 + sWhere + "order by HItemID desc", "h_v_Gy_UnitList");
                    ds = oCN.RunProcReturn(sql1 + sWhere + "order by 计量单位代码 ", "h_v_Gy_UnitList");
                }
                else
                {
                    string sql = sql1 + sWhere + "order by HItemID desc";
                    string sql = sql1 + sWhere + "order by 计量单位代码 ";
                    ds = oCN.RunProcReturn(sql, "h_v_Gy_UnitList");
                }
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
@@ -110,6 +121,8 @@
            string[] sArray = msg4.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg1 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string msg_HUSEORGID = sArray[2].ToString();
            Single msg_HRate = float.Parse(sArray[3]);
            Int64 HItemID = 0;
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
@@ -251,10 +264,11 @@
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //组织id
                    oItem.HShortNumber = sShortNumber;//短代码
                    oItem.HEndFlag = true;//末级标志
                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //等级
                    oItem.HRate= DBUtility.ClsPub.GetLevel(oItem.HRate.ToString().Trim());//换算比例
                    oItem.HRate= msg_HRate;//换算比例
                    oBill.oModel = oItem;
                }
@@ -362,7 +376,7 @@
                    return objJsonResult;
                }
                oCN.RunProc("update Gy_Unit set HStopflag=1 where HItemID=" + HItemID);
                oCN.RunProc("delete from Gy_Unit where HItemID=" + HItemID);
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;