Explorar el Código

档案物资与客户档案关联 根据客户编号获取客户信息 添加物资时客户编号必须正确

zhaozhiqiang %!s(int64=5) %!d(string=hace) años
padre
commit
4bcc46a5a4

+ 15 - 0
codegit/CallCenterApi/CallCenterApi.BLL/T_Cus_CustomerBaseNew.cs

@@ -64,7 +64,22 @@ namespace CallCenterApi.BLL
64 64
 
65 65
             return dal.GetModel(F_CustomerId);
66 66
         }
67
+        /// <summary>
68
+        /// 得到一个对象实体
69
+        /// </summary>
70
+        public CallCenterApi.Model.T_Cus_CustomerBaseNew GetModelcus(string openid)
71
+        {
67 72
 
73
+            return dal.GetModels(openid);
74
+        }
75
+        /// <summary>
76
+        /// 得到一个对象实体
77
+        /// </summary>
78
+        public CallCenterApi.Model.T_Cus_CustomerBaseNew GetModelcuscode(string archivecuscode)
79
+        {
80
+
81
+            return dal.GetModelcuscode(archivecuscode);
82
+        }
68 83
         /// <summary>
69 84
         /// 获得数据列表
70 85
         /// </summary>

+ 50 - 0
codegit/CallCenterApi/CallCenterApi.DAL/T_Cus_CustomerBaseNew.cs

@@ -374,6 +374,56 @@ namespace CallCenterApi.DAL
374 374
             }
375 375
         }
376 376
         /// <summary>
377
+        /// 得到一个对象实体
378
+        /// </summary>
379
+        public CallCenterApi.Model.T_Cus_CustomerBaseNew GetModels(string openid)
380
+        {
381
+
382
+            StringBuilder strSql = new StringBuilder();
383
+            strSql.Append("select  top 1 * from T_Cus_CustomerBaseNew ");
384
+            strSql.Append(" where F_WxOpenId=@openid");
385
+            SqlParameter[] parameters = {
386
+                    new SqlParameter("@openid", SqlDbType.NVarChar,300)
387
+            };
388
+            parameters[0].Value = openid;
389
+
390
+            CallCenterApi.Model.T_Cus_CustomerBaseNew model = new CallCenterApi.Model.T_Cus_CustomerBaseNew();
391
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
392
+            if (ds.Tables[0].Rows.Count > 0)
393
+            {
394
+                return DataRowToModel(ds.Tables[0].Rows[0]);
395
+            }
396
+            else
397
+            {
398
+                return null;
399
+            }
400
+        }
401
+        /// <summary>
402
+        /// 得到一个对象实体
403
+        /// </summary>
404
+        public CallCenterApi.Model.T_Cus_CustomerBaseNew GetModelcuscode(string archiveCode)
405
+        {
406
+
407
+            StringBuilder strSql = new StringBuilder();
408
+            strSql.Append("select  top 1 * from T_Cus_CustomerBaseNew ");
409
+            strSql.Append(" where F_CustomerCode=@archiveCode");
410
+            SqlParameter[] parameters = {
411
+                    new SqlParameter("@archiveCode", SqlDbType.NVarChar,100)
412
+            };
413
+            parameters[0].Value = archiveCode;
414
+
415
+            CallCenterApi.Model.T_Cus_CustomerBaseNew model = new CallCenterApi.Model.T_Cus_CustomerBaseNew();
416
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
417
+            if (ds.Tables[0].Rows.Count > 0)
418
+            {
419
+                return DataRowToModel(ds.Tables[0].Rows[0]);
420
+            }
421
+            else
422
+            {
423
+                return null;
424
+            }
425
+        }
426
+        /// <summary>
377 427
 		/// 得到一个对象实体
378 428
 		/// </summary>
379 429
 		public CallCenterApi.Model.T_Cus_CustomerBaseNew DataRowToModel(DataRow row)

+ 70 - 49
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/archives/archivesController.cs

@@ -27,12 +27,13 @@ namespace CallCenterApi.Interface.Controllers.archives
27 27
     public class archivesController : BaseController
28 28
     {
29 29
         CallCenterApi.BLL.archives archivesbll = new BLL.archives();
30
+        CallCenterApi.BLL.T_Cus_CustomerBaseNew cusbll = new BLL.T_Cus_CustomerBaseNew();
30 31
         // GET: archives
31 32
         /// <summary>
32 33
         /// 查询档案物资表数据信息
33 34
         /// </summary>
34 35
         /// <returns></returns>
35
-        public ActionResult GetList(int PageIndex, int PageSize,string A_archiveName)
36
+        public ActionResult GetList(int PageIndex, int PageSize,string A_archiveName,string openid)
36 37
         {
37 38
           
38 39
             
@@ -55,6 +56,15 @@ namespace CallCenterApi.Interface.Controllers.archives
55 56
                 }
56 57
                
57 58
             }
59
+            if (openid != null || openid != "")
60
+            {
61
+                Model.T_Cus_CustomerBaseNew cust = cusbll.GetModelcus(openid);
62
+                if (cust != null)
63
+                {
64
+                    sql += " and A_archiveCode ='"+cust.F_CustomerCode+"'";
65
+                }
66
+               
67
+            }
58 68
             Model.PageData<Model.archives> pageModel = new Model.PageData<Model.archives>();
59 69
             var recordCount = 0;
60 70
             var dt = BLL.PagerBLL.GetListPager(
@@ -133,60 +143,71 @@ namespace CallCenterApi.Interface.Controllers.archives
133 143
             if (archive.isadd <= 0)
134 144
             {
135 145
                 model.A_archiveCode = archive.A_archiveCode;//关联客户表中的F_CustomerCode客户编号 关联显示客户名称
136
-                model.A_archiveName = archive.A_archiveName;//物资名称
137
-                if (archive.A_archiveState == 0)
138
-                {
139
-                    model.A_archiveState = 1;//物资状态 关联物质状态表中的主键id  下拉选择    
140
-                }
141
-                else {
142
-                    model.A_archiveState = archive.A_archiveState;//物资状态 关联物质状态表中的主键id  下拉选择
143
-                }
144
-               
145
-                model.A_archivePeople =CurrentUser.UserData.F_UserCode; // //操作人 archive.A_archivePeople
146
-                var archivesid = archivesbll.Add(model);
147
-                if (archivesid > 0)
146
+
147
+                Model.T_Cus_CustomerBaseNew custom = cusbll.GetModelcuscode(archive.A_archiveCode);
148
+                if (custom != null)
148 149
                 {
149
-                    var Operationlogmodel = new CallCenterApi.Interface.Models.Input.OperationlogInput();
150
-                    Operationlogmodel.Operator = CurrentUser.UserData.F_UserCode;// CurrentUser.UserData.F_UserCode;//
151
-                    Operationlogmodel.OperationDate = DateTime.Now;
152
-                    Operationlogmodel.OperationContent = "添加了一条物资档案信息物资名称为:"+ archive.A_archiveName;
153
-                    Operationlogmodel.archivesid = archivesid;
154
-                    AddorUpdOperationlog(Operationlogmodel);
155
-                    return Success("添加档案成功" + ",操作人:" + CurrentUser.UserData.F_UserCode);
150
+                    model.A_archiveName = archive.A_archiveName;//物资名称
151
+                    if (archive.A_archiveState == 0)
152
+                    {
153
+                        model.A_archiveState = 1;//物资状态 关联物质状态表中的主键id  下拉选择    
154
+                    }
155
+                    else
156
+                    {
157
+                        model.A_archiveState = archive.A_archiveState;//物资状态 关联物质状态表中的主键id  下拉选择
158
+                    }
159
+
160
+                    model.A_archivePeople = CurrentUser.UserData.F_UserCode; // //操作人 archive.A_archivePeople
161
+                    var archivesid = archivesbll.Add(model);
162
+                    if (archivesid > 0)
163
+                    {
164
+                        var Operationlogmodel = new CallCenterApi.Interface.Models.Input.OperationlogInput();
165
+                        Operationlogmodel.Operator = CurrentUser.UserData.F_UserCode;// CurrentUser.UserData.F_UserCode;//
166
+                        Operationlogmodel.OperationDate = DateTime.Now;
167
+                        Operationlogmodel.OperationContent = "添加了一条物资档案信息物资名称为:" + archive.A_archiveName;
168
+                        Operationlogmodel.archivesid = archivesid;
169
+                        AddorUpdOperationlog(Operationlogmodel);
170
+                        return Success("添加档案成功" + ",操作人:" + CurrentUser.UserData.F_UserCode);
171
+                    }
172
+                    else
173
+                    {
174
+                        return Error("添加档案失败" + ",操作人:" + CurrentUser.UserData.F_UserCode);
175
+                    }
176
+
156 177
                 }
157 178
                 else
158 179
                 {
159
-                    return Error("添加档案失败" + ",操作人:" + CurrentUser.UserData.F_UserCode);
160
-                }  
180
+                    return Error("添加档案失败添加的客户编号不存在" + ",操作人:" + CurrentUser.UserData.F_UserCode);
181
+                }
161 182
                 
162 183
             }
163
-                 else { 
164
-                 model = archivesbll.GetModel(archive.id);
165
-                 var archname = model.A_archiveName;
166
-                 if (model == null)
167
-                     return Error("该档案不存在");
168
-                 //model.F_SortModel = input.F_SortModel;
169
-                 model.A_archiveCode = archive.A_archiveCode;
170
-                 model.A_archiveName = archive.A_archiveName;
171
-                 //model.A_archiveState = archive.A_archiveState;
172
-                 var uarchiveid = archive.id;
173
-                //model.A_archiveRecord = archive.A_archiveRecord;
174
-                model.A_archivePeople = CurrentUser.UserData.F_UserCode;// CurrentUser.UserData.F_UserCode;//操作人archive.A_archivePeople
175
-                var people = archive.A_archivePeople;
176
-                 if (archivesbll.Update(model))
177
-                 {
178
-                     var Operationlogmodel = new CallCenterApi.Interface.Models.Input.OperationlogInput();
179
-                    Operationlogmodel.Operator = CurrentUser.UserData.F_UserCode;// CurrentUser.UserData.F_UserCode;
180
-                     Operationlogmodel.OperationDate = DateTime.Now;
181
-                     Operationlogmodel.OperationContent = "修改了一条物资档案信息";
182
-                     Operationlogmodel.archivesid = uarchiveid;
183
-                     AddorUpdOperationlog(Operationlogmodel);
184
-                     return Success("修改档案成功" + ",操作人:" + CurrentUser.UserData.F_UserCode);
185
-                 }
186
-                 else {
187
-                       return Error("修改档案失败" + ",操作人:" + CurrentUser.UserData.F_UserCode);
188
-                 }
189
-                 }
184
+            else { 
185
+            model = archivesbll.GetModel(archive.id);
186
+            var archname = model.A_archiveName;
187
+            if (model == null)
188
+                return Error("该档案不存在");
189
+            //model.F_SortModel = input.F_SortModel;
190
+            model.A_archiveCode = archive.A_archiveCode;
191
+            model.A_archiveName = archive.A_archiveName;
192
+            //model.A_archiveState = archive.A_archiveState;
193
+            var uarchiveid = archive.id;
194
+           //model.A_archiveRecord = archive.A_archiveRecord;
195
+           model.A_archivePeople = CurrentUser.UserData.F_UserCode;// CurrentUser.UserData.F_UserCode;//操作人archive.A_archivePeople
196
+           var people = archive.A_archivePeople;
197
+            if (archivesbll.Update(model))
198
+            {
199
+                var Operationlogmodel = new CallCenterApi.Interface.Models.Input.OperationlogInput();
200
+               Operationlogmodel.Operator = CurrentUser.UserData.F_UserCode;// CurrentUser.UserData.F_UserCode;
201
+                Operationlogmodel.OperationDate = DateTime.Now;
202
+                Operationlogmodel.OperationContent = "修改了一条物资档案信息";
203
+                Operationlogmodel.archivesid = uarchiveid;
204
+                AddorUpdOperationlog(Operationlogmodel);
205
+                return Success("修改档案成功" + ",操作人:" + CurrentUser.UserData.F_UserCode);
206
+            }
207
+            else {
208
+                  return Error("修改档案失败" + ",操作人:" + CurrentUser.UserData.F_UserCode);
209
+            }
210
+            }
190 211
         }
191 212
 
192 213
         /// <summary>

+ 19 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerNewController.cs

@@ -164,6 +164,25 @@ namespace CallCenterApi.Interface.Controllers.customer
164 164
                 return Error("没有获取到相关公司,请重新搜索");
165 165
         }
166 166
         /// <summary>
167
+        /// 根据编号搜索公司
168
+        /// </summary>
169
+        public ActionResult GetListBycode(string customcode)
170
+        {
171
+            string sql = "";
172
+            if (!string.IsNullOrWhiteSpace(customcode))//关键字搜索
173
+                sql += $" F_CustomerCode like '%" + customcode.Trim() + "%'";
174
+            var list = new List<Model.T_Cus_CustomerBaseNew>();
175
+            if (!string.IsNullOrWhiteSpace(sql))
176
+            {
177
+                sql += " and F_DeleteFlag=0";
178
+                list = cusbll.GetModelList(sql);
179
+            }
180
+            if (list.Count > 0)
181
+                return Success("根据客户编号获取公司信息", list.FirstOrDefault());
182
+            else
183
+                return Error("没有获取到相关公司,请重新搜索");
184
+        }
185
+        /// <summary>
167 186
         /// 获取客户信息
168 187
         /// </summary>
169 188
         /// <returns></returns>