wtt
2024-10-08 e4c1d8a8c75368c091db094d616ddc7bafd52df8
WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
@@ -12,8 +12,8 @@
using SyntacticSugar.constant;
using System.Web;
using WebAPI.Controllers.SCGL.日计划管理;
using WebAPI.WebBLL.JCJM.GYZL;
using WebAPI.WebBLL.JCJM.IMPL;
//using WebAPI.WebBLL.JCJM.GYZL;
//using WebAPI.WebBLL.JCJM.IMPL;
using System.IO;
namespace WebAPI.Controllers
{
@@ -25,7 +25,7 @@
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        private Gy_CustomerService customerService = new Gy_CustomerImpl();
        //private Gy_CustomerService customerService = new Gy_CustomerImpl();
        DataSet ds;
        #region 返回客户列表
@@ -1367,41 +1367,41 @@
        #endregion
        #region 客户列表 文件上传
        [Route("Gy_Customer/Gy_Process_Excel")]
        [HttpPost]
        public json Gy_Department_Excel()
        {
            json res = new json();
            try
            {
                //获取文件名称
                var file = HttpContext.Current.Request.Files[0];
                //获取文件物理路径
                string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
                //保存文件
                file.SaveAs(ExcelPath);
        //[Route("Gy_Customer/Gy_Process_Excel")]
        //[HttpPost]
        //public json Gy_Department_Excel()
        //{
        //    json res = new json();
        //    try
        //    {
        //        //获取文件名称
        //        var file = HttpContext.Current.Request.Files[0];
        //        //获取文件物理路径
        //        string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
        //        //保存文件
        //        file.SaveAs(ExcelPath);
                NpoiHelper np = new NpoiHelper();
                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
                //删除文件
                File.Delete(ExcelPath);
                DataTable provisional = customerService.UploadExcel(ExcelDs);
        //        NpoiHelper np = new NpoiHelper();
        //        DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
        //        //删除文件
        //        File.Delete(ExcelPath);
        //        DataTable provisional = customerService.UploadExcel(ExcelDs);
                
                res.code = CodeConstant.SUCCEED;
                res.count = CountConstant.SUCCEED;
                res.Message = "上传成功";
                res.data = provisional;
                return res;
            }
            catch (Exception e)
            {
                res.code = "0";
                res.count = 0;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        //        res.code = CodeConstant.SUCCEED;
        //        res.count = CountConstant.SUCCEED;
        //        res.Message = "上传成功";
        //        res.data = provisional;
        //        return res;
        //    }
        //    catch (Exception e)
        //    {
        //        res.code = "0";
        //        res.count = 0;
        //        res.Message = "Exception!" + e.ToString();
        //        res.data = null;
        //        return res;
        //    }
        //}
        /// <summary>
        /// 判断当前职员是否存在
@@ -1409,15 +1409,15 @@
        /// <param name="HEmpNumber"></param>
        /// <param name="HEmpName"></param>
        /// <returns></returns>
        private bool JudgeEmp(string HEmpNumber, string HEmpName)
        {
            if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName))
            {
                DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
                return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false;
            }
            return false;
        }
        //private bool JudgeEmp(string HEmpNumber, string HEmpName)
        //{
        //    if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName))
        //    {
        //        DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
        //        return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false;
        //    }
        //    return false;
        //}
        /// <summary>
        /// 判断列