Просмотр исходного кода

导入调整,出库修改,openid !=null问题修改

liyuanyuan лет назад: 4
Родитель
Сommit
71207e0cda

+ 74 - 31
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/archives/archivesController.cs

@@ -22,6 +22,8 @@ using NPOI.HSSF.UserModel;
22 22
 using Newtonsoft.Json;
23 23
 using CallCenterApi.Common;
24 24
 using CallCenterAPI.WechatSDK;
25
+using NPOI.SS.Formula.Functions;
26
+using Senparc.Weixin.MP.AdvancedAPIs.User;
25 27
 
26 28
 namespace CallCenterApi.Interface.Controllers.archives
27 29
 {
@@ -683,7 +685,7 @@ namespace CallCenterApi.Interface.Controllers.archives
683 685
             stateid = archivesbll.GetStateid("已出库");
684 686
 
685 687
             var customername = "";
686
-            if (openid != null)
688
+            if (!string.IsNullOrEmpty(openid))
687 689
             {
688 690
                 Model.T_Cus_CustomerBaseNew cust = cusbll.GetModelcus(openid);
689 691
                 if (archivesbll.GetCustomerName(openid) != "")
@@ -717,6 +719,8 @@ namespace CallCenterApi.Interface.Controllers.archives
717 719
                 }
718 720
 
719 721
             }
722
+            var log = LogFactory.GetLogger("archivesController");
723
+            
720 724
             if (inside == 0)
721 725
             {
722 726
                 //外部操作表的记录
@@ -737,7 +741,9 @@ namespace CallCenterApi.Interface.Controllers.archives
737 741
                     //发送消息
738 742
                     BLL.T_Cus_CustomerBaseNew bll = new BLL.T_Cus_CustomerBaseNew();
739 743
                     Model.T_Cus_CustomerBaseNew model = bll.GetModelcusName(companyName);
740
-                    model.F_WxOpenId = "oVMGRtxOoKL9nMbRCR_Y2kRxjyRw";
744
+                    log.Error("wxopenid="+model.F_WxOpenId+";companyname="+companyName+";model:"+model.ToJson());
745
+
746
+                   // model.F_WxOpenId = "oVMGRtxOoKL9nMbRCR_Y2kRxjyRw";//苗的微信openid
741 747
                     if (model != null && !string.IsNullOrEmpty(model.F_WxOpenId))
742 748
                     {
743 749
                         sendckwxmsg(arcnames,model.F_WxOpenId);
@@ -788,7 +794,7 @@ namespace CallCenterApi.Interface.Controllers.archives
788 794
             stateid = archivesbll.GetStateid("在库");
789 795
 
790 796
             var customername = "";
791
-            if (openid != null)
797
+            if (!string.IsNullOrEmpty( openid))
792 798
             {
793 799
                 if (archivesbll.GetCustomerName(openid) != "")
794 800
                 {
@@ -843,7 +849,7 @@ namespace CallCenterApi.Interface.Controllers.archives
843 849
                     //发送消息
844 850
                     BLL.T_Cus_CustomerBaseNew bll = new BLL.T_Cus_CustomerBaseNew();
845 851
                     Model.T_Cus_CustomerBaseNew model = bll.GetModelcusName(companyName);
846
-                    model.F_WxOpenId = "oVMGRtxOoKL9nMbRCR_Y2kRxjyRw";
852
+                  //  model.F_WxOpenId = "oVMGRtxOoKL9nMbRCR_Y2kRxjyRw";//苗的微信openid
847 853
                     if (model != null && !string.IsNullOrEmpty(model.F_WxOpenId))
848 854
                     {
849 855
                         sendrkwxmsg(arcnames, model.F_WxOpenId);
@@ -899,7 +905,7 @@ namespace CallCenterApi.Interface.Controllers.archives
899 905
             stateid = archivesbll.GetStateid("借阅中");
900 906
 
901 907
             var customername = "";
902
-            if (openid != null)
908
+            if (!string.IsNullOrEmpty( openid))
903 909
             {
904 910
                 if (archivesbll.GetCustomerName(openid) != "")
905 911
                 {
@@ -967,7 +973,7 @@ namespace CallCenterApi.Interface.Controllers.archives
967 973
             stateid = archivesbll.GetStateid("在库");
968 974
 
969 975
             var customername = "";
970
-            if (openid != null)
976
+            if (!string.IsNullOrEmpty(openid))
971 977
             {
972 978
                 if (archivesbll.GetCustomerName(openid) != "")
973 979
                 {
@@ -1483,7 +1489,7 @@ namespace CallCenterApi.Interface.Controllers.archives
1483 1489
 
1484 1490
             //获取用户名称
1485 1491
             var customername = "";
1486
-            if (openid != null)
1492
+            if (!string.IsNullOrEmpty( openid))
1487 1493
             {
1488 1494
                 if (archivesbll.GetCustomerName(openid) != "")
1489 1495
                 {
@@ -1556,7 +1562,7 @@ namespace CallCenterApi.Interface.Controllers.archives
1556 1562
 
1557 1563
             //获取用户名称
1558 1564
             var customername = "";
1559
-            if (openid != null)
1565
+            if (!string.IsNullOrEmpty(openid))
1560 1566
             {
1561 1567
                 if (archivesbll.GetCustomerName(openid) != "")
1562 1568
                 {
@@ -2405,39 +2411,76 @@ namespace CallCenterApi.Interface.Controllers.archives
2405 2411
                     if (dt.Rows.Count < 1)
2406 2412
                         return Error("文件内容没有数据");
2407 2413
                     //导入后要插入数据库
2408
-                    var model = new Model.archivesNew();
2414
+                  //  var model = new Model.archivesNew();
2409 2415
                     //Model.T_RepositoryCategory pModel = new BLL.T_RepositoryCategory().GetModel(int.Parse(pid.Trim()));
2410 2416
                     var pmodel = list.FirstOrDefault();
2411 2417
                     //根据公司名称获取客户编号
2412 2418
                     Model.T_Cus_CustomerBaseNew customs = cusbll.GetModelcusName(dataRow[0].ToString());
2419
+                    string A_archiveCode = "";
2413 2420
                     if (customs != null)
2414 2421
                     {
2415
-                        model.A_archiveCode = customs.F_CustomerCode;// dataRow[0].ToString();
2422
+                         A_archiveCode = customs.F_CustomerCode;// dataRow[0].ToString();
2416 2423
                     }
2417
-                    else
2424
+                    //else
2425
+                    //{
2426
+                    //    model.A_archiveCode = "";
2427
+                    //}
2428
+
2429
+                    string name = dataRow[1].ToString();
2430
+                    if (name.Contains(","))
2418 2431
                     {
2419
-                        model.A_archiveCode = "";
2432
+                        string[] str = name.Split(',');
2433
+                        foreach (string item in str)
2434
+                        {
2435
+                            var modelnew = new Model.archivesNew();
2436
+                            modelnew.A_archiveCode = A_archiveCode;
2437
+                            modelnew.A_archiveName = item;
2438
+                            modelnew.A_CompanyName = dataRow[0].ToString();//公司名称
2439
+
2440
+                            modelnew.fileid = fid;
2441
+                            modelnew.A_archiveState = 1;
2442
+                            modelnew.A_archivePeople = CurrentUser.UserData.F_UserCode;//操作人
2443
+
2444
+
2445
+                            int n2 = bll.Add(modelnew);
2446
+                            if (n2 > 0)
2447
+                            {
2448
+                                var addlog = new addupdatelog();
2449
+                                addlog.OperationDate = DateTime.Now;
2450
+                                addlog.Operator = CurrentUser.UserData.F_UserCode;
2451
+                                addlog.OperationContent = "导入了一条物资,名称为:" + dataRow[1].ToString();
2452
+                                addlog.archivesid = n2;
2453
+                                addlog.companyName = dataRow[0].ToString();//公司名称
2454
+                                addlog.type = 0;//条件
2455
+
2456
+                                count++;
2457
+                            }
2458
+                        }
2420 2459
                     }
2421
-
2422
-                    model.A_CompanyName = dataRow[0].ToString();//公司名称
2423
-                    model.A_archiveName = dataRow[1].ToString();
2424
-                    model.fileid = fid;
2425
-                    model.A_archiveState = 1;
2426
-                    model.A_archivePeople = CurrentUser.UserData.F_UserCode;//操作人
2427
-
2428
-
2429
-                    int n = bll.Add(model);
2430
-                    if (n > 0)
2460
+                    else
2431 2461
                     {
2432
-                        var addlog = new addupdatelog();
2433
-                        addlog.OperationDate = DateTime.Now;
2434
-                        addlog.Operator= CurrentUser.UserData.F_UserCode;
2435
-                        addlog.OperationContent= "导入了一条物资,名称为:"+ dataRow[1].ToString();
2436
-                        addlog.archivesid = n;
2437
-                        addlog.companyName= dataRow[0].ToString();//公司名称
2438
-                        addlog.type = 0;//条件
2439
-                       
2440
-                        count++;
2462
+                        var model = new Model.archivesNew();
2463
+                        model.A_archiveCode = A_archiveCode;
2464
+                        model.A_CompanyName = dataRow[0].ToString();//公司名称
2465
+                        model.A_archiveName = dataRow[1].ToString();
2466
+                        model.fileid = fid;
2467
+                        model.A_archiveState = 1;
2468
+                        model.A_archivePeople = CurrentUser.UserData.F_UserCode;//操作人
2469
+
2470
+
2471
+                        int n = bll.Add(model);
2472
+                        if (n > 0)
2473
+                        {
2474
+                            var addlog = new addupdatelog();
2475
+                            addlog.OperationDate = DateTime.Now;
2476
+                            addlog.Operator = CurrentUser.UserData.F_UserCode;
2477
+                            addlog.OperationContent = "导入了一条物资,名称为:" + dataRow[1].ToString();
2478
+                            addlog.archivesid = n;
2479
+                            addlog.companyName = dataRow[0].ToString();//公司名称
2480
+                            addlog.type = 0;//条件
2481
+
2482
+                            count++;
2483
+                        }
2441 2484
                     }
2442 2485
                 }
2443 2486
                 if (dt == null || dt.Rows.Count == 0)