| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610 |
- using CallCenter.Utility;
- using CallCenterApi.Common;
- using CallCenterApi.Interface.Controllers.Base;
- using CallCenterApi.Interface.Models.Input;
- using CallCenterApi.Model;
- using Newtonsoft.Json;
- using NPOI.HSSF.UserModel;
- using NPOI.SS.UserModel;
- using NPOI.XSSF.UserModel;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.IO;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers.customer
- {
- public class CustomerNewController : BaseController
- {
- BLL.T_Cus_CustomerBaseNew cusbll = new BLL.T_Cus_CustomerBaseNew();
- BLL.T_Cus_ContactPersonNew conbll = new BLL.T_Cus_ContactPersonNew();
- BLL.T_Sys_Department deptbll = new BLL.T_Sys_Department();
- BLL.T_Sys_RoleInfo rolebll = new BLL.T_Sys_RoleInfo();
- BLL.T_Cus_CustomerFinance finbll = new BLL.T_Cus_CustomerFinance();
- BLL.T_Sys_Department departmentBLL = new BLL.T_Sys_Department();
- #region 客户管理
- /// <summary>
- /// 获取客户列表
- /// </summary>
- /// <param name="code">客户编号</param>
- /// <param name="cmpname">公司名称</param>
- /// <param name="cmpaddress">公司地址</param>
- /// <param name="legname">法人姓名</param>
- /// <param name="legtel">法人电话</param>
- /// <param name="subtrade">所属行业</param>
- /// <param name="layer">客户信誉等级</param>
- /// <param name="bedept">客户归属部门</param>
- /// <param name="bereladd">客户归属涉税会计</param>
- /// <param name="beaudacc">客户归属审核会计</param>
- /// <param name="bemakeacc">客户归属做账会计</param>
- /// <param name="conname">联系人姓名</param>
- /// <param name="contel">联系人电话</param>
- /// <returns></returns>
- public ActionResult GetList(string code, string cmpname, string legname, string legtel,string province, string city,
- string country, string township, int areaid = 0, int branchid = 0,int pageindex = 1, int pagesize = 10)
- {
- string sql = $" and F_IsDelete=0";
- DataTable dt = new DataTable();
- #region 筛选条件
- if (areaid > 0)//大区
- sql += $" and F_AreaID=" + areaid;
- if (branchid > 0)//分公司
- sql += $" and F_BranchID=" + branchid;
- if (!string.IsNullOrWhiteSpace(code))//客户编号
- {
- if (valcode(code))
- sql += $" and F_CustomerCode like '%" + code.Trim() + "%'";
- }
- if (!string.IsNullOrWhiteSpace(cmpname))//公司名称
- sql += $" and F_CompanyName like '%" + cmpname.Trim() + "%'";
- if (!string.IsNullOrWhiteSpace(legname))//法人姓名
- sql += $" and F_Legal like '%" + legname.Trim() + "%'";
- if (!string.IsNullOrWhiteSpace(legtel))//法人电话
- sql += $" and F_LegalPhone like '%" + legtel.Trim() + "%'";
- if (!string.IsNullOrWhiteSpace(province))//省
- sql += $" and F_AddressProvince like '%" + province.Trim() + "%'";
- if (!string.IsNullOrWhiteSpace(province))//市
- sql += $" and F_AddressCity like '%" + city.Trim() + "%'";
- if (!string.IsNullOrWhiteSpace(province))//县
- sql += $" and F_AddressCountry like '%" + country.Trim() + "%'";
- if (!string.IsNullOrWhiteSpace(province))//乡
- sql += $" and F_AddressTownship like '%" + township.Trim() + "%'";
- #endregion
- int recordCount = 0;
- if (!string.IsNullOrWhiteSpace(sql))
- {
- dt = BLL.PagerBLL.GetListPager(
- "T_Cus_CustomerBaseNew",
- "F_CustomerId",
- "*,dbo.GetUserName(F_CreateBy) as F_CreateByName",
- sql,
- "ORDER BY F_CustomerId desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- }
- List<Model.T_Cus_CustomerBaseNew> modlelist = new BLL.T_Cus_CustomerBaseNew().DataTableToList(dt);
- List<CustomerBaseNewInput> Input = modeltooip(modlelist);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = Input,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 根据关键字搜索公司
- /// </summary>
- public ActionResult GetListByKey(string keywords)
- {
- string sql = "";
- if (!string.IsNullOrWhiteSpace(keywords))//关键字搜索
- sql += $" ( F_CompanyName like '%" + keywords.Trim() + "%' or F_CustomerCode like '%" + keywords.Trim() + "%' ) ";
- var list = new List<Model.T_Cus_CustomerBaseNew>();
- if (!string.IsNullOrWhiteSpace(sql))
- {
- sql += " and F_IsDelete=0";
- list = cusbll.GetModelList(sql);
- }
- if (list.Count >0)
- {
- List<CustomerBaseNewInput> Input = modeltooip(list);
- if (Input!=null )
- return Success("根据关键字获取公司信息", Input.FirstOrDefault());
- else
- return Error("没有获取到相关公司,请重新搜索");
- }
- else
- return Error("没有获取到相关公司,请重新搜索");
- }
- /// <summary>
- /// 获取客户信息
- /// </summary>
- /// <returns></returns>
- public ActionResult GetCustomer(int cusid)
- {
- if (cusid != 0)
- {
- Model.T_Cus_CustomerBaseNew userModel = cusbll.GetModel(cusid);
- List<Model.T_Cus_CustomerBaseNew> model = new List<T_Cus_CustomerBaseNew>();
- if (userModel != null)
- {
- model.Add(userModel);
- List<CustomerBaseNewInput> Input = modeltooip(model);
- return Success("获取成功", Input.FirstOrDefault());
- }
- else
- {
- return Error("获取失败");
- }
- }
- else
- {
- return Error("参数传输失败");
- }
- }
- /// <summary>
- /// 通过来电号码获取来电弹屏左侧客户信息
- /// </summary>
- /// <returns></returns>
- public ActionResult GetCustomerByTel(string tel)
- {
- if (!string.IsNullOrWhiteSpace(tel))
- {
- var sql = $" and (F_SalesPhone like '%" + tel.Trim() + "%' or F_LegalPhone like '%" + tel.Trim() + "%')";
- var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
- if (userModel.Count() > 0)
- {
- List<CustomerBaseNewInput> Input = modeltooip(userModel);
- var model = Input.Last();
- return Success("获取成功", model);
- }
- else
- {
- return Success("获取成功");
- }
- }
- else
- {
- return Error("参数传输失败");
- }
- }
- /// <summary>
- /// 添加客户信息
- /// </summary>
- /// <returns></returns>
- public ActionResult Add(CustomerBaseNewInput input)
- {
- string usercode = CurrentUser.UserData.F_UserCode;
- #region 添加验证判断
- if (string.IsNullOrEmpty(input.F_CustomerCode))
- return Error("编号不能为空!");
- if (!valcode(input.F_CustomerCode))
- return Error("编号必须是10位数字");
- if (getunique(0, input.F_CustomerCode))
- return Error("编号已被占用,请重新输入!");
- #endregion
- var model = new Model.T_Cus_CustomerBaseNew();
- #region 保存客户基本信息
- model = inputtoobj(model, input);
- model.F_CreateBy = usercode;
- model.F_CreateOn = DateTime.Now;
- model.F_IsDelete = 0;
- #endregion
- int n = cusbll.Add(model);
- if (n > 0)
- {
- return Success("新增成功!");
- }
- else
- return Error("新增失败!");
- }
- /// <summary>
- /// 修改客户信息
- /// </summary>
- /// <returns></returns>
- public ActionResult Update(CustomerBaseNewInput input)
- {
- string usercode = CurrentUser.UserData.F_UserCode;
- #region 添加验证判断
- if (input.F_CustomerId <= 0)
- return Error("参数错误!");
- if (getunique(input.F_CustomerId, input.F_CustomerCode))
- return Error("编号已被占用,请重新输入!");
- #endregion
- var model = cusbll.GetModel(input.F_CustomerId);
- #region 保存客户基本信息
- model = inputtoobj(model, input);
- #endregion
- bool n = cusbll.Update(model);
- if (n)
- {
- return Success("保存成功!");
- }
- else
- return Error("保存失败!");
- }
- /// <summary>
- /// 根据model返回CustomerBaseNewInput对象
- /// </summary>
- private List<CustomerBaseNewInput> modeltooip(List <Model.T_Cus_CustomerBaseNew> model)
- {
- if (model!=null &&model .Count >0)
- {
- List<CustomerBaseNewInput> Input = new List<CustomerBaseNewInput>(model.Count);
- for (int i=0;i<model .Count;i++)
- {
- CustomerBaseNewInput Input1 = new CustomerBaseNewInput();
- #region 基本字段
- if (!string.IsNullOrWhiteSpace(model[i].F_CustomerCode))
- Input1.F_CustomerCode = model[i].F_CustomerCode;
-
- if (!string.IsNullOrWhiteSpace(model[i].F_CompanyName))
- Input1.F_CompanyName = model[i].F_CompanyName;
- Input1.F_AreaID = model[i].F_AreaID;//大区ID
- Input1.F_BranchID = model[i].F_BranchID;//分公司ID
- Model.T_Sys_Department pdModel = departmentBLL.GetModel(model[i].F_AreaID);
- if (pdModel != null)
- {
- Input1.F_AreaName = pdModel.F_DeptName.ToString();
- }
- Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(model[i].F_BranchID);
- if (pdModel1 != null)
- {
- Input1.F_BranchName = pdModel1.F_DeptName.ToString();
- }
-
- Input1.F_Salesman = model[i].F_Salesman;//业务员
- Input1.F_SalesPhone = model[i].F_SalesPhone;//业务员电话
- Input1.F_CustomerNature = model[i].F_CustomerNature;//客户性质
- Input1.F_Channel = model[i].F_Channel;// 渠道类型:总经销、二级商、种田大户、农户、化工客户、公司员工
- Input1.F_Credit = model[i].F_Credit;//信用等级:一星、二星、三星、四星、五星、空
- Input1.F_Legal = model[i].F_Legal;//法人
- Input1.F_LegalPhone = model[i].F_LegalPhone;//法人电话
- Input1.F_AddressProvince = model[i].F_AddressProvince;//省
- Input1.F_AddressCity = model[i].F_AddressCity;//市
- Input1.F_AddressCountry = model[i].F_AddressCountry;//县
- Input1.F_AddressTownship = model[i].F_AddressTownship;//乡
- Input1.F_AddressFull = model[i].F_AddressFull;//详细地址
- Input1.F_Brands = model[i].F_Brands;// 经营品牌:心连心、手拉手、沃利沃、双心、空
- Input1.F_Product = model[i].F_Product;//产品:复合肥心连心、复合肥手拉手、复合肥沃利沃、复合肥双心、尿素心连心、尿素手拉手、尿素沃利沃、尿素双心
- Input1.F_FrozenFlag = model[i].F_FrozenFlag;//冻结标志
- Input1.F_IsOpenAccount = model[i].F_IsOpenAccount;//是否开户:已开户、未开户
- Input1.F_LevelCode = model[i].F_LevelCode;//上级客户编码
- Input1.F_LevelName = model[i].F_LevelName;//上级客户名称
- Input1.F_MnemonicCode = model[i].F_MnemonicCode;//助记码
- Input1.F_InvoiceBank = model[i].F_InvoiceBank;//开票银行名称
- Input1.F_InvoiceBankAccount = model[i].F_InvoiceBankAccount;//开票银行账号
- Input1.F_TaxRegCode = model[i].F_TaxRegCode;//纳税人登记号
- Input1.F_IsRunXLX = model[i].F_IsRunXLX;// 是否经营心连心:是、否
- Input1.F_AnnualSales = model[i].F_AnnualSales;//年销量
- Input1.F_Formula = model[i].F_Formula;//配方
- Input1.F_RaiseCrops = model[i].F_RaiseCrops;//种植作物
- Input1.F_PlantingArea = model[i].F_PlantingArea;//种植面积
- Input1.F_FertilizerBrand = model[i].F_FertilizerBrand;//用肥品牌
- Input1.F_Remark = model[i].F_Remark;//备注
- Input1.F_FileId = 0;
- Input.Add(Input1);
- #endregion
- }
- return Input;
- }
- else
- {
- return null;
- }
- }
- /// <summary>
- /// 根据传入的对象和input的内容返回对象
- /// </summary>
- private Model.T_Cus_CustomerBaseNew inputtoobj(Model.T_Cus_CustomerBaseNew model,CustomerBaseNewInput input)
- {
- var newmodel = model;
- if (!string.IsNullOrWhiteSpace(input.F_CustomerCode))
- model.F_CustomerCode = input.F_CustomerCode;
- else
- model.F_CustomerCode = model.F_CustomerCode;
- if (!string.IsNullOrWhiteSpace(input.F_CompanyName))
- model.F_CompanyName = input.F_CompanyName;
- #region 基本字段
- model.F_AreaID = input.F_AreaID;//大区ID
- model.F_BranchID = input.F_BranchID;//分公司ID
- model.F_Salesman = input.F_Salesman;//业务员
- model.F_SalesPhone = input.F_SalesPhone;//业务员电话
- model.F_CustomerNature = input.F_CustomerNature;//客户性质
- model.F_Channel = input.F_Channel;// 渠道类型:总经销、二级商、种田大户、农户、化工客户、公司员工
- model.F_Credit = input.F_Credit;//信用等级:一星、二星、三星、四星、五星、空
- model.F_Legal = input.F_Legal;//法人
- model.F_LegalPhone = input.F_LegalPhone;//法人电话
- model.F_AddressProvince = input.F_AddressProvince;//省
- model.F_AddressCity = input.F_AddressCity;//市
- model.F_AddressCountry = input.F_AddressCountry;//县
- model.F_AddressTownship = input.F_AddressTownship;//乡
- model.F_AddressFull = input.F_AddressFull;//详细地址
- model.F_Brands = input.F_Brands;// 经营品牌:心连心、手拉手、沃利沃、双心、空
- model.F_Product = input.F_Product;//产品:复合肥心连心、复合肥手拉手、复合肥沃利沃、复合肥双心、尿素心连心、尿素手拉手、尿素沃利沃、尿素双心
- model.F_FrozenFlag = input.F_FrozenFlag;//冻结标志
- model.F_IsOpenAccount = input.F_IsOpenAccount;//是否开户:已开户、未开户
- model.F_LevelCode = input.F_LevelCode;//上级客户编码
- model.F_LevelName = input.F_LevelName;//上级客户名称
- model.F_MnemonicCode = input.F_MnemonicCode;//助记码
- model.F_InvoiceBank = input.F_InvoiceBank;//开票银行名称
- model.F_InvoiceBankAccount = input.F_InvoiceBankAccount;//开票银行账号
- model.F_TaxRegCode = input.F_TaxRegCode;//纳税人登记号
- model.F_IsRunXLX = input.F_IsRunXLX;// 是否经营心连心:是、否
- model.F_AnnualSales = input.F_AnnualSales;//年销量
- model.F_Formula = input.F_Formula;//配方
- model.F_RaiseCrops = input.F_RaiseCrops;//种植作物
- model.F_PlantingArea = input.F_PlantingArea;//种植面积
- model.F_FertilizerBrand = input.F_FertilizerBrand;//用肥品牌
- model.F_Remark = input.F_Remark;//备注
- model.F_FileId = 0;
- #endregion
- return model;
- }
- /// <summary>
- /// 验证客户编号是否唯一
- /// </summary>
- private bool getunique(int id, string code)
- {
- var sql = " F_IsDelete=0 ";
- sql += "and (F_CustomerCode='" + code + "')";
- if (id > 0)
- sql += " and F_CustomerId<>"+id;
- var count=cusbll.GetModelList(sql).Count();
-
- return count > 0;
- }
- /// <summary>
- /// 删除客户
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- public ActionResult DelCustomer(string[] ids)
- {
- if (ids != null && ids.Length > 0)
- {
- string idd = " ";
- foreach (string str in ids)
- {
- idd += str + ",";
- }
- if (!string.IsNullOrEmpty(idd.Trim()))
- {
- if (cusbll.DeleteList(idd.TrimEnd(',')))
- {
- conbll.DeleteListByCusid(idd.TrimEnd(','));
- return Success("设置成功");
- }
- else
- {
- return Error("设置失败");
- }
- }
- else
- {
- return Error("请选择用户");
- }
- }
- else
- {
- return Error("获取参数失败");
- }
- }
- #region 客户使用微信端才会使用
- ///// <summary>
- ///// 重置密码
- ///// </summary>
- ///// <param name="ids"></param>
- ///// <returns></returns>
- //public ActionResult UpdatePWD(string[] ids)
- //{
- // if (ids != null && ids.Length > 0)
- // {
- // string idd = " ";
- // foreach (string str in ids)
- // {
- // idd += str + ",";
- // }
- // if (!string.IsNullOrEmpty(idd.Trim()))
- // {
- // if (cusbll.UpdatePWD(idd.TrimEnd(','),"123456"))
- // {
- // return Success("设置成功");
- // }
- // else
- // {
- // return Error("设置失败");
- // }
- // }
- // else
- // {
- // return Error("请选择用户");
- // }
- // }
- // else
- // {
- // return Error("获取参数失败");
- // }
- //}
- #endregion
- #endregion
- #region 导入客户资料
- /// <summary>
- /// 导入excel
- /// </summary>
- public ActionResult ImportExcel()
- {
- string usercode = CurrentUser.UserData.F_UserCode;
- string ip = DTRequest.GetIP();
- if (!string.IsNullOrWhiteSpace(usercode))
- {
- HttpPostedFile _upFile = RequestString.GetFile("upFile");
- if (_upFile != null)
- {
- int headrow = 0;
- #region 上传文件
- string filepath = "";
- string datepath = DateTime.Now.ToString("yyyyMMddHHMMss");
- string aLastName = Path.GetExtension(_upFile.FileName);
- string oriname = Path.GetFileNameWithoutExtension(_upFile.FileName);
- if (aLastName != ".xls" && aLastName != ".xlsx")
- {
- return Error("文件类型错误,请选择Excel文件");
- }
- string newpath = datepath + "_" + _upFile.FileName;
- if (!Directory.Exists(Server.MapPath(this.Request.ApplicationPath + "\\ExcelData")))
- {
- Directory.CreateDirectory(Server.MapPath(this.Request.ApplicationPath + "\\ExcelData"));
- }
- filepath = this.Request.ApplicationPath + "/ExcelData/" + newpath;
- string PhysicalPath = Server.MapPath(filepath);
- _upFile.SaveAs(PhysicalPath);
- #endregion
- #region 添加附件日志
- Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
- model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
- model_T_Sys_Accessories.F_FileName = newpath;//附件名称
- model_T_Sys_Accessories.F_FileType = aLastName;//附件类型
- model_T_Sys_Accessories.F_FileUrl = filepath;//附件地址
- model_T_Sys_Accessories.F_UserCode = usercode;//上传人
- model_T_Sys_Accessories.F_OriName = oriname;
- int fid = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
- #endregion
- NPOIHelper np = new NPOIHelper();
- DataTable dt = np.ExcelToTable(_upFile, headrow);
- string msg = string.Empty;
- if (dt == null || dt.Rows.Count == 0)
- return Error("文件没有数据");
- else
- {
- Model.T_Cus_CustomerBaseNew dModel = new Model.T_Cus_CustomerBaseNew();
- dModel.F_CreateBy = usercode;
- dModel.F_IsDelete = 0;
- dModel.F_FileId = fid;
- foreach (DataRow dr in dt.Rows)
- {
- #region 数据入库
- headrow = headrow + 1;
-
- if (dr["客户编号"].ToString() != "" && valcode(dr["客户编号"].ToString()))
- {
- dModel.F_CustomerCode = dr["客户编号"].ToString();
- dModel.F_CompanyName = dr["公司名称"].ToString();
-
- #region
-
- Model.T_Sys_Department pdModel = departmentBLL.GetModel(dr["大区名称"].ToString());
- if (pdModel!=null )
- {
- dModel.F_AreaID = pdModel.F_DeptId.ToString();
- }
- Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(dr["分公司名称"].ToString());
- if (pdModel1!=null )
- {
- dModel.F_BranchID = pdModel1.F_DeptId.ToString();
- }
-
- dModel.F_Salesman = dr["业务员"].ToString();
- dModel.F_SalesPhone = dr["业务员电话"].ToString();
- dModel.F_CustomerNature = dr["客户性质"].ToString();
- dModel.F_Channel = dr["渠道类型"].ToString();
- dModel.F_Credit = dr["信用等级"].ToString();
- dModel.F_Legal = dr["法人"].ToString();
- dModel.F_LegalPhone = dr["法人电话"].ToString();
- dModel.F_AddressProvince = dr["省"].ToString();
- dModel.F_AddressCity = dr["市"].ToString();
- dModel.F_AddressCountry = dr["县"].ToString();
- dModel.F_AddressTownship = dr["乡"].ToString();
- dModel.F_AddressFull = dr["详细地址"].ToString();
- dModel.F_Brands = dr["经营品牌"].ToString();
- dModel.F_Product = dr["产品"].ToString();
- dModel.F_FrozenFlag = dr["冻结标志"].ToString();
- dModel.F_IsOpenAccount = dr["是否开户"].ToString();
- dModel.F_LevelCode = dr["上级客户编码"].ToString();
- dModel.F_LevelName = dr["上级客户名称"].ToString();
- dModel.F_MnemonicCode = dr["助记码"].ToString();
- dModel.F_InvoiceBank = dr["开票银行名称"].ToString();
- dModel.F_InvoiceBankAccount = dr["开票银行账号"].ToString();
- dModel.F_TaxRegCode = dr["纳税人登记号"].ToString();
- dModel.F_IsRunXLX = dr["是否经营心连心"].ToString();
- dModel.F_AnnualSales = dr["年销量"].ToString();
- dModel.F_Formula = dr["配方"].ToString();
- dModel.F_RaiseCrops = dr["种植作物"].ToString();
- dModel.F_PlantingArea = dr["种植面积"].ToString();
- dModel.F_FertilizerBrand = dr["用肥品牌"].ToString();
- dModel.F_Remark = dr["备注"].ToString();
- #endregion
- dModel.F_CreateOn = DateTime.Now;
- var res = cusbll.Add(dModel);
- if (res > 0)
- {
- addoptlog(usercode, ip, EnumOpt.import.ToString(), res.ToString(), "导入成功,导入的文件为:" + newpath + ",当前为第" + headrow + "行");
- }
- else
- {
- msg = msg + "第" + headrow + "行,导入失败<br>";
- }
- }
- else
- msg = msg + "第" + headrow + "行,物料编号为空或格式不正确,未导入<br>";
- #endregion
- }
- if (string.IsNullOrEmpty(msg))
- return Success("导入成功 " );
- else
- return Error(msg);
- }
- }
- return Error("数据源上传失败");
- }
- return Error("用户登录失败,请重新登录");
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 验证物料编码为10位纯数字
- /// </summary>
- private bool valcode(string code)
- {
- var res = false;
- //11位数字
- if (code.Length == 10 && Regex.IsMatch(code, @"^\d{10}$"))
- res = true;
- return res;
- }
- /// <summary>
- /// 操作日志
- /// </summary>
- /// <param name="usercode">操作人工号</param>
- /// <param name="ip">操作人IP</param>
- /// <param name="optcode">操作编号</param>
- /// <param name="optid">操作id</param>
- /// <param name="des">操作描述</param>
- private void addoptlog(string usercode, string ip, string optcode, string optid, string des)
- {
- new BLL.T_Sys_OperateLogs().AddOptLog("客户管理", usercode, ip, des, optcode, "T_Cus_CustomerBaseNew", optid);
- }
- #endregion
- }
- }
|