yangle
2023-09-12 7b778c7647e1c14288f7919290b7c403989c541c
WebAPI/Controllers/¹¤×ʹÜÀí/Pay_WorkTimesBillController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -328,8 +329,6 @@
                return objJsonResult;
            }
        }
        //
        /// <summary>
        /// é€šè¿‡ç­ç»„查询职员信息
        ///参数:string sql。
@@ -343,7 +342,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "产品器具未选择";
                objJsonResult.Message = "班组未选择";
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -372,6 +371,78 @@
                return objJsonResult;
            }
        }
        [Route("Pay_WorkTimesBill/calcAvgMoney")]
        [HttpPost]
        public object GetEmployeeByHGroup([FromBody] JObject msg) {
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                List<object> list = new List<object>();
                DataSet ds;
                string sql = string.Format($"exec h_p_CalcAvgMoney '{msg["msg"]}'");
                ds = oCN.RunProcReturn(sql, "h_p_CalcAvgMoney");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "获取信息成功!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #region è€ƒå‹¤æ±‡æ€»æ•°æ®å¤„理表查询
        [Route("Pay_WorkTimesSumQueryBill/list")]
        [HttpGet]
        public object getWorkTimesSumQueryBillList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (!DBUtility.ClsPub.Security_Log("Pay_WorkTimesSumQueryBillList", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("exec h_p_Pay_WorkTimesSumQueryBillList " + sWhere, "Pay_WorkTimesSumQueryBillList");
                //添加列名
                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)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}