|
|
@@ -38,7 +38,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
38
|
38
|
/// </summary>
|
|
39
|
39
|
/// <returns></returns>
|
|
40
|
40
|
public ActionResult GetList(string code, string cusname, string cusphone,string createby, string starttime, string endtime, string keywords, string companyname, string province, string city,
|
|
41
|
|
- string country,string telephone, string township, string touser, int source=0,int type = 0, int state=-1, int pageindex = 1,int pagesize = 10)
|
|
|
41
|
+ string country,string telephone, string township, string touser,string strvisit,string endvisit, int source=0,int type = 0, int state=-1, int pageindex = 1,int pagesize = 10)
|
|
42
|
42
|
{
|
|
43
|
43
|
|
|
44
|
44
|
int userId = CurrentUser.UserData.F_UserId;
|
|
|
@@ -53,10 +53,14 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
53
|
53
|
sql += $" and F_Source=" + source;
|
|
54
|
54
|
if (!string.IsNullOrWhiteSpace(touser))//参与人
|
|
55
|
55
|
sql += $" and F_DealBy like '%" + touser.Trim() + "%'";
|
|
56
|
|
- if (starttime.Trim() != "" && starttime != "undefined")
|
|
|
56
|
+ if (!string.IsNullOrEmpty(starttime))
|
|
57
|
57
|
sql += " and datediff(day,F_CreateOn,'" + starttime + "')<=0 ";
|
|
58
|
|
- if (endtime.Trim() != "" && endtime != "undefined")
|
|
|
58
|
+ if (!string.IsNullOrEmpty(endtime))
|
|
59
|
59
|
sql += " and datediff(day,F_CreateOn,'" + endtime + "')>=0 ";
|
|
|
60
|
+ if (!string.IsNullOrEmpty(strvisit))
|
|
|
61
|
+ sql += " and datediff(day,F_VisitOn,'" + strvisit + "')<=0 ";
|
|
|
62
|
+ if (!string .IsNullOrEmpty (endvisit))
|
|
|
63
|
+ sql += " and datediff(day,F_VisitOn,'" + endvisit + "')>=0 ";
|
|
60
|
64
|
if (!string.IsNullOrWhiteSpace(keywords))//关键字搜索
|
|
61
|
65
|
sql += $" and ( F_CusName like '%" + keywords.Trim() + "%'or F_CusPhone like '%" + keywords.Trim() + "%' ) ";
|
|
62
|
66
|
if (!string.IsNullOrWhiteSpace(code))//工单编号
|
|
|
@@ -2226,7 +2230,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
2226
|
2230
|
///综合查询列表
|
|
2227
|
2231
|
/// </summary>
|
|
2228
|
2232
|
public ActionResult GetComprehensive(string code, string cusname,string createby, string starttime, string endtime, string keywords, string cusphone, string companyname, string province, string city,
|
|
2229
|
|
- string country, string township,string category,string salebase, string touser, int source = 0,int state=-1, int type = 0, int pageindex = 1, int pagesize = 10)
|
|
|
2233
|
+ string country, string township,string category,string salebase, string touser,string visitby, string visitresult, int source = 0,int state=-1, int type = 0, int pageindex = 1, int pagesize = 10)
|
|
2230
|
2234
|
{
|
|
2231
|
2235
|
int userId = CurrentUser.UserData.F_UserId;
|
|
2232
|
2236
|
if (userId != 0)
|
|
|
@@ -2289,6 +2293,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
2289
|
2293
|
sql += $" and F_IncidentCountry like '%" + country.Trim() + "%'";
|
|
2290
|
2294
|
if (!string.IsNullOrWhiteSpace(province))//乡
|
|
2291
|
2295
|
sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
|
|
|
2296
|
+ if (!string.IsNullOrWhiteSpace(visitby))//回访人
|
|
|
2297
|
+ sql += $" and F_VisitBy like '%" + visitby.Trim() + "%'";
|
|
|
2298
|
+ if (!string.IsNullOrWhiteSpace(visitresult))//回访结果
|
|
|
2299
|
+ sql += $" and F_VisitResult like '%" + visitresult.Trim() + "%'";
|
|
2292
|
2300
|
Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
|
|
2293
|
2301
|
Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
|
|
2294
|
2302
|
if (ro.F_RoleCode == "QTJS" || ro.F_RoleCode == "YWY")
|
|
|
@@ -2450,8 +2458,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
2450
|
2458
|
sql += $" and F_IncidentCountry like '%" + country.Trim() + "%'";
|
|
2451
|
2459
|
if (!string.IsNullOrWhiteSpace(province))//乡
|
|
2452
|
2460
|
sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
|
|
2453
|
|
- sql += $" and F_State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," +
|
|
2454
|
|
- (int)EnumWorkOrderState.assign + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + ")";
|
|
|
2461
|
+
|
|
2455
|
2462
|
sql += $" and F_IsOver=" + 1;
|
|
2456
|
2463
|
Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
|
|
2457
|
2464
|
Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
|
|
|
@@ -3759,51 +3766,55 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
3759
|
3766
|
for (int i = 0; i < model1.Count; i++)
|
|
3760
|
3767
|
{
|
|
3761
|
3768
|
WorkOrderNewInput model = new WorkOrderNewInput();
|
|
3762
|
|
- if (!string .IsNullOrEmpty(model1[i].F_CustomerID))
|
|
|
3769
|
+ Model.T_Cus_CustomerBaseNew cuModel = new Model.T_Cus_CustomerBaseNew();
|
|
|
3770
|
+ if (!string.IsNullOrEmpty(model1[i].F_CustomerID))
|
|
3763
|
3771
|
{
|
|
3764
|
|
- // var sql = "and F_LegalPhone ='" + model1[i ].F_CusPhone.Trim() + "'";
|
|
3765
|
|
- // var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
|
|
3766
|
|
- Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(model1[i].F_CustomerID.ToString());//通过客户编号获取客户资料
|
|
3767
|
|
- if (cuModel != null)
|
|
3768
|
|
- {
|
|
3769
|
|
- if (!string .IsNullOrEmpty (cuModel.F_AreaID))
|
|
|
3772
|
+ cuModel = cusbll .GetModel(model1[i].F_CustomerID.ToString());//通过客户编号获取客户资料
|
|
|
3773
|
+ }
|
|
|
3774
|
+ else
|
|
|
3775
|
+ {
|
|
|
3776
|
+ var sql = $" and F_LegalPhone ='" + model1[i].F_CusPhone.Trim() + "'";
|
|
|
3777
|
+ cuModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql).FirstOrDefault();
|
|
|
3778
|
+ }
|
|
|
3779
|
+ if (cuModel != null)
|
|
|
3780
|
+ {
|
|
|
3781
|
+ if (!string.IsNullOrEmpty(cuModel.F_AreaID))
|
|
|
3782
|
+ {
|
|
|
3783
|
+ Model.T_Sys_Department pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
|
|
|
3784
|
+ if (pdModel != null)
|
|
3770
|
3785
|
{
|
|
3771
|
|
- Model.T_Sys_Department pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
|
|
3772
|
|
- if (pdModel != null)
|
|
3773
|
|
- {
|
|
3774
|
|
- model.F_AreaName = pdModel.F_DeptName;
|
|
3775
|
|
- }
|
|
|
3786
|
+ model.F_AreaName = pdModel.F_DeptName;
|
|
3776
|
3787
|
}
|
|
3777
|
|
- if (!string .IsNullOrEmpty (cuModel.F_BranchID))
|
|
|
3788
|
+ }
|
|
|
3789
|
+ if (!string.IsNullOrEmpty(cuModel.F_BranchID))
|
|
|
3790
|
+ {
|
|
|
3791
|
+ Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));
|
|
|
3792
|
+ if (pdModel1 != null)
|
|
3778
|
3793
|
{
|
|
3779
|
|
- Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));
|
|
3780
|
|
- if (pdModel1 != null)
|
|
3781
|
|
- {
|
|
3782
|
|
- model.F_BranchName = pdModel1.F_DeptName;
|
|
3783
|
|
- }
|
|
3784
|
|
- }
|
|
3785
|
|
- model.F_CustomerID = cuModel.F_CustomerCode;//客户编码
|
|
3786
|
|
- model.F_Salesman = cuModel.F_Salesman;
|
|
3787
|
|
- model.F_SalesPhone = cuModel.F_SalesPhone;
|
|
3788
|
|
- model.F_Legal = cuModel.F_Legal;
|
|
3789
|
|
- model.F_LegalPhone = cuModel.F_LegalPhone;
|
|
3790
|
|
- model.F_AddressProvince = cuModel.F_AddressProvince;
|
|
3791
|
|
- model.F_AddressCity = cuModel.F_AddressCity;
|
|
3792
|
|
- model.F_AddressCountry = cuModel.F_AddressCountry;
|
|
3793
|
|
- model.F_AddressTownship = cuModel.F_AddressTownship;
|
|
3794
|
|
- model.F_AddressFull = cuModel.F_AddressFull;
|
|
3795
|
|
- model.F_Brands = cuModel.F_Brands;
|
|
3796
|
|
- model.F_Channel = cuModel.F_Channel;
|
|
3797
|
|
- model.F_Channel = cuModel.F_CompanyName ;
|
|
3798
|
|
- model.F_IsRunXLX = cuModel.F_IsRunXLX;
|
|
3799
|
|
- model.F_AnnualSales = cuModel.F_AnnualSales;
|
|
3800
|
|
- model.F_Formula = cuModel.F_Formula;
|
|
3801
|
|
- model.F_RaiseCrops = cuModel.F_RaiseCrops;
|
|
3802
|
|
- model.F_PlantingArea = cuModel.F_PlantingArea;
|
|
3803
|
|
- model.F_FertilizerBrand = cuModel.F_FertilizerBrand;
|
|
|
3794
|
+ model.F_BranchName = pdModel1.F_DeptName;
|
|
3804
|
3795
|
}
|
|
|
3796
|
+ }
|
|
|
3797
|
+ model.F_CustomerID = cuModel.F_CustomerCode;//客户编码
|
|
|
3798
|
+ model.F_Salesman = cuModel.F_Salesman;
|
|
|
3799
|
+ model.F_SalesPhone = cuModel.F_SalesPhone;
|
|
|
3800
|
+ model.F_Legal = cuModel.F_Legal;
|
|
|
3801
|
+ model.F_LegalPhone = cuModel.F_LegalPhone;
|
|
|
3802
|
+ model.F_AddressProvince = cuModel.F_AddressProvince;
|
|
|
3803
|
+ model.F_AddressCity = cuModel.F_AddressCity;
|
|
|
3804
|
+ model.F_AddressCountry = cuModel.F_AddressCountry;
|
|
|
3805
|
+ model.F_AddressTownship = cuModel.F_AddressTownship;
|
|
|
3806
|
+ model.F_AddressFull = cuModel.F_AddressFull;
|
|
|
3807
|
+ model.F_Brands = cuModel.F_Brands;
|
|
|
3808
|
+ model.F_Channel = cuModel.F_Channel;
|
|
|
3809
|
+ model.F_Channel = cuModel.F_CompanyName;
|
|
|
3810
|
+ model.F_IsRunXLX = cuModel.F_IsRunXLX;
|
|
|
3811
|
+ model.F_AnnualSales = cuModel.F_AnnualSales;
|
|
|
3812
|
+ model.F_Formula = cuModel.F_Formula;
|
|
|
3813
|
+ model.F_RaiseCrops = cuModel.F_RaiseCrops;
|
|
|
3814
|
+ model.F_PlantingArea = cuModel.F_PlantingArea;
|
|
|
3815
|
+ model.F_FertilizerBrand = cuModel.F_FertilizerBrand;
|
|
3805
|
3816
|
}
|
|
3806
|
|
-
|
|
|
3817
|
+
|
|
3807
|
3818
|
if (valcode(model1[i].F_MaterialID.ToString(), 11))
|
|
3808
|
3819
|
{
|
|
3809
|
3820
|
model.F_MaterialID = model1[i].F_MaterialID;//验证物料编码为11位纯数字
|
|
|
@@ -4359,6 +4370,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
4359
|
4370
|
dModel.F_CreateBy = usercode;
|
|
4360
|
4371
|
int f = mmBLL.Add(dModel);
|
|
4361
|
4372
|
}
|
|
|
4373
|
+
|
|
4362
|
4374
|
/// <summary>
|
|
4363
|
4375
|
/// 根据传入的对象和input的内容返回对象(添加修改使用)
|
|
4364
|
4376
|
/// </summary>
|
|
|
@@ -4387,36 +4399,51 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
4387
|
4399
|
model.F_Source = model.F_Source.ToString();//工单来源
|
|
4388
|
4400
|
}
|
|
4389
|
4401
|
#region 基本字段
|
|
4390
|
|
- if (type == 2)
|
|
4391
|
|
- {
|
|
|
4402
|
+
|
|
4392
|
4403
|
|
|
4393
|
4404
|
if (input.F_Type == 2 || input.F_Type == 3)
|
|
4394
|
4405
|
{
|
|
4395
|
|
- //if (string .IsNullOrEmpty(input.F_CustomerID))
|
|
4396
|
|
- //{
|
|
4397
|
|
- // int i = 0;
|
|
4398
|
|
- // while (true)
|
|
4399
|
|
- // {
|
|
4400
|
|
- // if (!getunique(0, GetCusCode(i)))
|
|
4401
|
|
- // {
|
|
4402
|
|
- // input.F_CustomerID = GetCusCode(i);
|
|
4403
|
|
- // break;
|
|
4404
|
|
- // }
|
|
4405
|
|
- // else
|
|
4406
|
|
- // {
|
|
4407
|
|
- // i++;
|
|
4408
|
|
- // }
|
|
4409
|
|
- // }
|
|
4410
|
|
- // #endregion
|
|
4411
|
|
- // var Customer = new Model.T_Cus_CustomerBaseNew();
|
|
4412
|
|
- // #region 保存客户基本信息
|
|
4413
|
|
- // Customer = inputtooCustomer(Customer, input);
|
|
4414
|
|
- // Customer.F_CreateBy = usercode;
|
|
4415
|
|
- // Customer.F_CreateOn = DateTime.Now;
|
|
4416
|
|
- // Customer.F_IsDelete = 0;
|
|
4417
|
|
- // #endregion
|
|
4418
|
|
- // int b = cusbll.Add(Customer);
|
|
4419
|
|
- // }
|
|
|
4406
|
+ if (string.IsNullOrEmpty(input.F_CustomerID))
|
|
|
4407
|
+ {
|
|
|
4408
|
+ var sql = $" and F_LegalPhone = '" + input.F_CusPhone.Trim() + "'";
|
|
|
4409
|
+ var Customer = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql).FirstOrDefault(); ;
|
|
|
4410
|
+ if (Customer!=null )
|
|
|
4411
|
+ {
|
|
|
4412
|
+ model.F_CustomerID = Customer.F_CustomerCode;
|
|
|
4413
|
+ if (!string.IsNullOrEmpty(input.F_Salesman))
|
|
|
4414
|
+ Customer.F_Salesman = input.F_Salesman;
|
|
|
4415
|
+ if (!string.IsNullOrEmpty(input.F_SalesPhone))
|
|
|
4416
|
+ Customer.F_SalesPhone = input.F_SalesPhone;
|
|
|
4417
|
+ if (!string.IsNullOrEmpty(input.F_Brands))
|
|
|
4418
|
+ Customer.F_Brands = input.F_Brands;
|
|
|
4419
|
+ if (!string.IsNullOrEmpty(input.F_AreaName))
|
|
|
4420
|
+ Customer.F_AreaID = input.F_AreaName.Trim();
|
|
|
4421
|
+ if (!string.IsNullOrEmpty(input.F_BranchName))
|
|
|
4422
|
+ Customer.F_BranchID = input.F_BranchName.Trim();
|
|
|
4423
|
+ cusbll.Update(Customer);
|
|
|
4424
|
+ }
|
|
|
4425
|
+
|
|
|
4426
|
+
|
|
|
4427
|
+ }
|
|
|
4428
|
+ else
|
|
|
4429
|
+ {
|
|
|
4430
|
+ var Customer = cusbll.GetModel(input.F_CustomerID.Trim());
|
|
|
4431
|
+ if (Customer!=null )
|
|
|
4432
|
+ {
|
|
|
4433
|
+ if (!string.IsNullOrEmpty(input.F_Salesman))
|
|
|
4434
|
+ Customer.F_Salesman = input.F_Salesman;
|
|
|
4435
|
+ if (!string.IsNullOrEmpty(input.F_SalesPhone))
|
|
|
4436
|
+ Customer.F_SalesPhone = input.F_SalesPhone;
|
|
|
4437
|
+ if (!string.IsNullOrEmpty(input.F_Brands))
|
|
|
4438
|
+ Customer.F_Brands = input.F_Brands;
|
|
|
4439
|
+ if (!string.IsNullOrEmpty(input.F_AreaName))
|
|
|
4440
|
+ Customer.F_AreaID = input.F_AreaName.Trim();
|
|
|
4441
|
+ if (!string.IsNullOrEmpty(input.F_BranchName))
|
|
|
4442
|
+ Customer.F_BranchID = input.F_BranchName.Trim();
|
|
|
4443
|
+ cusbll.Update(Customer);
|
|
|
4444
|
+ }
|
|
|
4445
|
+
|
|
|
4446
|
+ }
|
|
4420
|
4447
|
if ( IsMaterial(input))
|
|
4421
|
4448
|
{
|
|
4422
|
4449
|
if (string.IsNullOrEmpty(input.F_MaterialID))
|
|
|
@@ -4440,7 +4467,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
4440
|
4467
|
}
|
|
4441
|
4468
|
}
|
|
4442
|
4469
|
}
|
|
4443
|
|
- }
|
|
|
4470
|
+
|
|
4444
|
4471
|
#endregion
|
|
4445
|
4472
|
model.F_Canal = input.F_Canal;//生产批次号
|
|
4446
|
4473
|
model.F_Type = input.F_Type.ToString();//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
|