Selaa lähdekoodia

添加大区名称分公司名称

duhongyu 6 vuotta sitten
vanhempi
commit
cb92b5664e

+ 88 - 9
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerNewController.cs

@@ -89,11 +89,13 @@ namespace CallCenterApi.Interface.Controllers.customer
89 89
                     true,
90 90
                     out recordCount);
91 91
             }
92
+            List<Model.T_Cus_CustomerBaseNew> modlelist = new BLL.T_Cus_CustomerBaseNew().DataTableToList(dt);
93
+            List<CustomerBaseNewInput> Input = modeltooip(modlelist);
92 94
             var obj = new
93 95
             {
94 96
                 state = "success",
95 97
                 message = "成功",
96
-                rows = dt,
98
+                rows = Input,
97 99
                 total = recordCount
98 100
             };
99 101
 
@@ -114,8 +116,9 @@ namespace CallCenterApi.Interface.Controllers.customer
114 116
                 sql += " and F_IsDelete=0";
115 117
                 list = cusbll.GetModelList(sql);
116 118
             }
117
-            if (list.Count > 0)
118
-                return Success("根据关键字获取公司信息", list.FirstOrDefault());
119
+            List<CustomerBaseNewInput> Input = modeltooip(list);
120
+            if (Input.Count > 0)
121
+                return Success("根据关键字获取公司信息", Input.FirstOrDefault());
119 122
             else
120 123
                 return Error("没有获取到相关公司,请重新搜索");
121 124
         }
@@ -128,9 +131,12 @@ namespace CallCenterApi.Interface.Controllers.customer
128 131
             if (cusid != 0)
129 132
             {
130 133
                 Model.T_Cus_CustomerBaseNew userModel = cusbll.GetModel(cusid);
134
+                List<Model.T_Cus_CustomerBaseNew> model = new List<T_Cus_CustomerBaseNew>();
131 135
                 if (userModel != null)
132 136
                 {
133
-                    return Success("获取成功", userModel);
137
+                    model.Add(userModel);
138
+                    List<CustomerBaseNewInput> Input = modeltooip(model);
139
+                    return Success("获取成功", Input.FirstOrDefault());
134 140
                 }
135 141
                 else
136 142
                 {
@@ -155,7 +161,8 @@ namespace CallCenterApi.Interface.Controllers.customer
155 161
                 var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
156 162
                 if (userModel.Count() > 0)
157 163
                 {
158
-                    var model = userModel.Last();
164
+                    List<CustomerBaseNewInput> Input = modeltooip(userModel);
165
+                    var model = Input.Last();
159 166
 
160 167
                     return Success("获取成功", model);
161 168
                 }
@@ -226,7 +233,77 @@ namespace CallCenterApi.Interface.Controllers.customer
226 233
             else
227 234
                 return Error("保存失败!");
228 235
         }
236
+        /// <summary>
237
+        /// 根据model返回CustomerBaseNewInput对象
238
+        /// </summary>
239
+        private List<CustomerBaseNewInput> modeltooip(List <Model.T_Cus_CustomerBaseNew> model)
240
+        {
241
+            if (model!=null &&model .Count >0)
242
+            {
243
+                List<CustomerBaseNewInput> Input = new List<CustomerBaseNewInput>(model.Count);
244
+                for (int i=0;i<model .Count;i++)
245
+                {
246
+                    CustomerBaseNewInput Input1 = new CustomerBaseNewInput();
247
+                    #region 基本字段
248
+                    if (!string.IsNullOrWhiteSpace(model[i].F_CustomerCode))
249
+                        Input1.F_CustomerCode = model[i].F_CustomerCode;
250
+                 
251
+                    if (!string.IsNullOrWhiteSpace(model[i].F_CompanyName))
252
+                        Input1.F_CompanyName = model[i].F_CompanyName;
253
+                    Input1.F_AreaID = model[i].F_AreaID;//大区ID
254
+                    Input1.F_BranchID = model[i].F_BranchID;//分公司ID
255
+                    Model.T_Sys_Department pdModel = departmentBLL.GetModel(model[i].F_AreaID);
256
+                    if (pdModel != null)
257
+                    {
258
+                        Input1.F_AreaName = pdModel.F_DeptName.ToString();
259
+                    }
260
+                    Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(model[i].F_BranchID);
261
+                    if (pdModel1 != null)
262
+                    {
263
+                        Input1.F_BranchName = pdModel1.F_DeptName.ToString();
264
+                    }
265
+                    Input1.F_Salesman = model[i].F_Salesman;//业务员
266
+                    Input1.F_SalesPhone = model[i].F_SalesPhone;//业务员电话
267
+                    Input1.F_CustomerNature = model[i].F_CustomerNature;//客户性质
268
+                    Input1.F_Channel = model[i].F_Channel;// 渠道类型:总经销、二级商、种田大户、农户、化工客户、公司员工
269
+                    Input1.F_Credit = model[i].F_Credit;//信用等级:一星、二星、三星、四星、五星、空
270
+                    Input1.F_Legal = model[i].F_Legal;//法人 
271
+                    Input1.F_LegalPhone = model[i].F_LegalPhone;//法人电话
272
+                    Input1.F_AddressProvince = model[i].F_AddressProvince;//省
273
+                    Input1.F_AddressCity = model[i].F_AddressCity;//市
274
+                    Input1.F_AddressCountry = model[i].F_AddressCountry;//县
275
+                    Input1.F_AddressTownship = model[i].F_AddressTownship;//乡
276
+                    Input1.F_AddressFull = model[i].F_AddressFull;//详细地址
277
+                    Input1.F_Brands = model[i].F_Brands;// 经营品牌:心连心、手拉手、沃利沃、双心、空
278
+                    Input1.F_Product = model[i].F_Product;//产品:复合肥心连心、复合肥手拉手、复合肥沃利沃、复合肥双心、尿素心连心、尿素手拉手、尿素沃利沃、尿素双心
279
+                    Input1.F_FrozenFlag = model[i].F_FrozenFlag;//冻结标志
280
+                    Input1.F_IsOpenAccount = model[i].F_IsOpenAccount;//是否开户:已开户、未开户
281
+                    Input1.F_LevelCode = model[i].F_LevelCode;//上级客户编码
282
+                    Input1.F_LevelName = model[i].F_LevelName;//上级客户名称
283
+                    Input1.F_MnemonicCode = model[i].F_MnemonicCode;//助记码
284
+                    Input1.F_InvoiceBank = model[i].F_InvoiceBank;//开票银行名称
285
+                    Input1.F_InvoiceBankAccount = model[i].F_InvoiceBankAccount;//开票银行账号
286
+                    Input1.F_TaxRegCode = model[i].F_TaxRegCode;//纳税人登记号
287
+                    Input1.F_IsRunXLX = model[i].F_IsRunXLX;// 是否经营心连心:是、否
288
+                    Input1.F_AnnualSales = model[i].F_AnnualSales;//年销量
289
+                    Input1.F_Formula = model[i].F_Formula;//配方
290
+                    Input1.F_RaiseCrops = model[i].F_RaiseCrops;//种植作物
291
+                    Input1.F_PlantingArea = model[i].F_PlantingArea;//种植面积
292
+                    Input1.F_FertilizerBrand = model[i].F_FertilizerBrand;//用肥品牌
293
+                    Input1.F_Remark = model[i].F_Remark;//备注
294
+                    Input1.F_FileId = 0;
295
+                    Input.Add(Input1);
296
+                    #endregion
297
+                }
298
+
299
+                return Input;
300
+            }
301
+            else
302
+            {
303
+                return null;
304
+            }
229 305
 
306
+        }
230 307
         /// <summary>
231 308
         /// 根据传入的对象和input的内容返回对象
232 309
         /// </summary>
@@ -240,7 +317,6 @@ namespace CallCenterApi.Interface.Controllers.customer
240 317
             if (!string.IsNullOrWhiteSpace(input.F_CompanyName))
241 318
                 model.F_CompanyName = input.F_CompanyName;
242 319
             #region 基本字段
243
-          
244 320
             model.F_AreaID = input.F_AreaID;//大区ID
245 321
             model.F_BranchID = input.F_BranchID;//分公司ID
246 322
             model.F_Salesman = input.F_Salesman;//业务员
@@ -426,17 +502,20 @@ namespace CallCenterApi.Interface.Controllers.customer
426 502
                             {
427 503
                                 dModel.F_CustomerCode = dr["客户编号"].ToString();
428 504
                                 dModel.F_CompanyName = dr["公司名称"].ToString();
505
+                               
429 506
                                 #region
507
+                                
430 508
                                 Model.T_Sys_Department pdModel = departmentBLL.GetModel(dr["大区名称"].ToString());
431
-                                Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(dr["分公司名称"].ToString());
432
-                                if (!string .IsNullOrEmpty(pdModel.F_DeptId.ToString()))
509
+                                if (pdModel!=null )
433 510
                                 {
434 511
                                     dModel.F_AreaID = pdModel.F_DeptId.ToString();
435 512
                                 }
436
-                                if (!string.IsNullOrEmpty(pdModel1.F_DeptId.ToString()))
513
+                                    Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(dr["分公司名称"].ToString());
514
+                                if (pdModel1!=null )
437 515
                                 {
438 516
                                     dModel.F_BranchID = pdModel1.F_DeptId.ToString();
439 517
                                 }
518
+                             
440 519
                                 dModel.F_Salesman = dr["业务员"].ToString();
441 520
                                 dModel.F_SalesPhone = dr["业务员电话"].ToString();
442 521
                                 dModel.F_CustomerNature = dr["客户性质"].ToString();

+ 8 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Input/CustomerBaseNewInput.cs

@@ -24,10 +24,18 @@ namespace CallCenterApi.Interface.Models.Input
24 24
         /// </summary>
25 25
         public string F_AreaID { set; get; }
26 26
         /// <summary>
27
+        /// 大区名称
28
+        /// </summary>
29
+        public string F_AreaName { set; get; }
30
+        /// <summary>
27 31
         /// 分公司ID
28 32
         /// </summary>
29 33
         public string F_BranchID { set; get; }
30 34
         /// <summary>
35
+        /// 分公司名称
36
+        /// </summary>
37
+        public string F_BranchName { set; get; }
38
+        /// <summary>
31 39
         /// 业务员
32 40
         /// </summary>
33 41
         public string F_Salesman { set; get; }