ソースを参照

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

liyuanyuan 4 年 前
コミット
71207e0cda
共有1 個のファイルを変更した74 個の追加31 個の削除を含む
  1. 74 31
      codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/archives/archivesController.cs

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

22
 using Newtonsoft.Json;
22
 using Newtonsoft.Json;
23
 using CallCenterApi.Common;
23
 using CallCenterApi.Common;
24
 using CallCenterAPI.WechatSDK;
24
 using CallCenterAPI.WechatSDK;
25
+using NPOI.SS.Formula.Functions;
26
+using Senparc.Weixin.MP.AdvancedAPIs.User;
25
 
27
 
26
 namespace CallCenterApi.Interface.Controllers.archives
28
 namespace CallCenterApi.Interface.Controllers.archives
27
 {
29
 {
683
             stateid = archivesbll.GetStateid("已出库");
685
             stateid = archivesbll.GetStateid("已出库");
684
 
686
 
685
             var customername = "";
687
             var customername = "";
686
-            if (openid != null)
688
+            if (!string.IsNullOrEmpty(openid))
687
             {
689
             {
688
                 Model.T_Cus_CustomerBaseNew cust = cusbll.GetModelcus(openid);
690
                 Model.T_Cus_CustomerBaseNew cust = cusbll.GetModelcus(openid);
689
                 if (archivesbll.GetCustomerName(openid) != "")
691
                 if (archivesbll.GetCustomerName(openid) != "")
717
                 }
719
                 }
718
 
720
 
719
             }
721
             }
722
+            var log = LogFactory.GetLogger("archivesController");
723
+            
720
             if (inside == 0)
724
             if (inside == 0)
721
             {
725
             {
722
                 //外部操作表的记录
726
                 //外部操作表的记录
737
                     //发送消息
741
                     //发送消息
738
                     BLL.T_Cus_CustomerBaseNew bll = new BLL.T_Cus_CustomerBaseNew();
742
                     BLL.T_Cus_CustomerBaseNew bll = new BLL.T_Cus_CustomerBaseNew();
739
                     Model.T_Cus_CustomerBaseNew model = bll.GetModelcusName(companyName);
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
                     if (model != null && !string.IsNullOrEmpty(model.F_WxOpenId))
747
                     if (model != null && !string.IsNullOrEmpty(model.F_WxOpenId))
742
                     {
748
                     {
743
                         sendckwxmsg(arcnames,model.F_WxOpenId);
749
                         sendckwxmsg(arcnames,model.F_WxOpenId);
788
             stateid = archivesbll.GetStateid("在库");
794
             stateid = archivesbll.GetStateid("在库");
789
 
795
 
790
             var customername = "";
796
             var customername = "";
791
-            if (openid != null)
797
+            if (!string.IsNullOrEmpty( openid))
792
             {
798
             {
793
                 if (archivesbll.GetCustomerName(openid) != "")
799
                 if (archivesbll.GetCustomerName(openid) != "")
794
                 {
800
                 {
843
                     //发送消息
849
                     //发送消息
844
                     BLL.T_Cus_CustomerBaseNew bll = new BLL.T_Cus_CustomerBaseNew();
850
                     BLL.T_Cus_CustomerBaseNew bll = new BLL.T_Cus_CustomerBaseNew();
845
                     Model.T_Cus_CustomerBaseNew model = bll.GetModelcusName(companyName);
851
                     Model.T_Cus_CustomerBaseNew model = bll.GetModelcusName(companyName);
846
-                    model.F_WxOpenId = "oVMGRtxOoKL9nMbRCR_Y2kRxjyRw";
852
+                  //  model.F_WxOpenId = "oVMGRtxOoKL9nMbRCR_Y2kRxjyRw";//苗的微信openid
847
                     if (model != null && !string.IsNullOrEmpty(model.F_WxOpenId))
853
                     if (model != null && !string.IsNullOrEmpty(model.F_WxOpenId))
848
                     {
854
                     {
849
                         sendrkwxmsg(arcnames, model.F_WxOpenId);
855
                         sendrkwxmsg(arcnames, model.F_WxOpenId);
899
             stateid = archivesbll.GetStateid("借阅中");
905
             stateid = archivesbll.GetStateid("借阅中");
900
 
906
 
901
             var customername = "";
907
             var customername = "";
902
-            if (openid != null)
908
+            if (!string.IsNullOrEmpty( openid))
903
             {
909
             {
904
                 if (archivesbll.GetCustomerName(openid) != "")
910
                 if (archivesbll.GetCustomerName(openid) != "")
905
                 {
911
                 {
967
             stateid = archivesbll.GetStateid("在库");
973
             stateid = archivesbll.GetStateid("在库");
968
 
974
 
969
             var customername = "";
975
             var customername = "";
970
-            if (openid != null)
976
+            if (!string.IsNullOrEmpty(openid))
971
             {
977
             {
972
                 if (archivesbll.GetCustomerName(openid) != "")
978
                 if (archivesbll.GetCustomerName(openid) != "")
973
                 {
979
                 {
1483
 
1489
 
1484
             //获取用户名称
1490
             //获取用户名称
1485
             var customername = "";
1491
             var customername = "";
1486
-            if (openid != null)
1492
+            if (!string.IsNullOrEmpty( openid))
1487
             {
1493
             {
1488
                 if (archivesbll.GetCustomerName(openid) != "")
1494
                 if (archivesbll.GetCustomerName(openid) != "")
1489
                 {
1495
                 {
1556
 
1562
 
1557
             //获取用户名称
1563
             //获取用户名称
1558
             var customername = "";
1564
             var customername = "";
1559
-            if (openid != null)
1565
+            if (!string.IsNullOrEmpty(openid))
1560
             {
1566
             {
1561
                 if (archivesbll.GetCustomerName(openid) != "")
1567
                 if (archivesbll.GetCustomerName(openid) != "")
1562
                 {
1568
                 {
2405
                     if (dt.Rows.Count < 1)
2411
                     if (dt.Rows.Count < 1)
2406
                         return Error("文件内容没有数据");
2412
                         return Error("文件内容没有数据");
2407
                     //导入后要插入数据库
2413
                     //导入后要插入数据库
2408
-                    var model = new Model.archivesNew();
2414
+                  //  var model = new Model.archivesNew();
2409
                     //Model.T_RepositoryCategory pModel = new BLL.T_RepositoryCategory().GetModel(int.Parse(pid.Trim()));
2415
                     //Model.T_RepositoryCategory pModel = new BLL.T_RepositoryCategory().GetModel(int.Parse(pid.Trim()));
2410
                     var pmodel = list.FirstOrDefault();
2416
                     var pmodel = list.FirstOrDefault();
2411
                     //根据公司名称获取客户编号
2417
                     //根据公司名称获取客户编号
2412
                     Model.T_Cus_CustomerBaseNew customs = cusbll.GetModelcusName(dataRow[0].ToString());
2418
                     Model.T_Cus_CustomerBaseNew customs = cusbll.GetModelcusName(dataRow[0].ToString());
2419
+                    string A_archiveCode = "";
2413
                     if (customs != null)
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
                 if (dt == null || dt.Rows.Count == 0)
2486
                 if (dt == null || dt.Rows.Count == 0)