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

微信端和pc端都适用借阅归还出库入库接口

zhaozhiqiang лет назад: 5
Родитель
Сommit
f7bd5c0808

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

@@ -428,11 +428,19 @@ namespace CallCenterApi.Interface.Controllers.archives
428 428
 
429 429
             //获取用户名称
430 430
             var customername = "";
431
-            if (archivesbll.GetCustomerName(openid) != "")
431
+            if (openid != null)
432 432
             {
433
-                customername = archivesbll.GetCustomerName(openid);
433
+                if (archivesbll.GetCustomerName(openid) != "")
434
+                {
435
+                    customername = archivesbll.GetCustomerName(openid);
436
+                }
434 437
             }
435
-
438
+            else
439
+            {
440
+                customername = CurrentUser.UserData.F_UserCode;
441
+            }
442
+            if (archivesids == null)
443
+                return Error("编号为空" + ",操作人:" + customername);
436 444
             //将多个物品id数据转成数据格式
437 445
             string[] arrStr = archivesids.Split(',');
438 446
             foreach (var item in arrStr)
@@ -493,11 +501,19 @@ namespace CallCenterApi.Interface.Controllers.archives
493 501
 
494 502
             //获取用户名称
495 503
             var customername = "";
496
-            if (archivesbll.GetCustomerName(openid) != "")
504
+            if (openid != null)
497 505
             {
498
-                customername = archivesbll.GetCustomerName(openid);
506
+                if (archivesbll.GetCustomerName(openid) != "")
507
+                {
508
+                    customername = archivesbll.GetCustomerName(openid);
509
+                }
499 510
             }
500
-
511
+            else
512
+            {
513
+                customername = CurrentUser.UserData.F_UserCode;
514
+            }
515
+            if (archivesids == null)
516
+                return Error("编号为空" + ",操作人:" + customername);
501 517
             //将多个物品id数据转成数据格式
502 518
             string[] arrStr = archivesids.Split(',');
503 519
             foreach (var item in arrStr)
@@ -692,11 +708,11 @@ namespace CallCenterApi.Interface.Controllers.archives
692 708
             
693 709
         }
694 710
         /// <summary>
695
-        /// 内部员工入库
711
+        /// PC内部员工入库
696 712
         /// </summary>
697 713
         /// <param name="archive"></param>
698 714
         /// <returns></returns>
699
-        public ActionResult insideOperationRK(string archivesids)
715
+        public ActionResult insideOperationRK(string archivesids, string openid)
700 716
         {
701 717
             var model = new CallCenterApi.Model.insideOperation();
702 718
 
@@ -707,6 +723,21 @@ namespace CallCenterApi.Interface.Controllers.archives
707 723
             {
708 724
                 stateid = archivesbll.GetStateid("在库");
709 725
             }
726
+            //获取用户名称
727
+            var customername = "";
728
+            if(openid!=null)
729
+            { 
730
+                if (archivesbll.GetCustomerName(openid) != "")
731
+                {
732
+                    customername = archivesbll.GetCustomerName(openid);
733
+                }
734
+            }
735
+            else
736
+            {
737
+                customername = CurrentUser.UserData.F_UserCode;
738
+            }
739
+            if(archivesids==null)
740
+                return Error("编号为空" + ",操作人:" + customername);
710 741
             //将多个物品id数据转成数据格式
711 742
             string[] arrStr = archivesids.Split(',');
712 743
             foreach (var item in arrStr)
@@ -717,12 +748,12 @@ namespace CallCenterApi.Interface.Controllers.archives
717 748
                 model.archivesid = Convert.ToInt32(item);//物品编号
718 749
                 model.Warehousing = "入库";//区分入库还是出库
719 750
                 model.WarehousingDate = DateTime.Now;//操作时间
720
-                model.Operator = CurrentUser.UserData.F_UserCode;// CurrentUser.UserData.F_UserCode; //操作人insideOperation.Operator
751
+                model.Operator = customername;// CurrentUser.UserData.F_UserCode; //操作人insideOperation.Operator
721 752
                 var arvichid = Convert.ToInt32(item);
722 753
                 if (archivesbll.AddinsideOperation(model) > 0)
723 754
                 {
724 755
                     var Operationlogmodel = new CallCenterApi.Interface.Models.Input.OperationlogInput();
725
-                    Operationlogmodel.Operator = CurrentUser.UserData.F_UserCode;
756
+                    Operationlogmodel.Operator = customername;
726 757
                     Operationlogmodel.OperationDate = DateTime.Now;
727 758
                     Operationlogmodel.OperationContent = "添加了一条入库信息";
728 759
                     Operationlogmodel.archivesid = arvichid;
@@ -730,28 +761,44 @@ namespace CallCenterApi.Interface.Controllers.archives
730 761
                 }
731 762
                 else
732 763
                 {
733
-                    return Error("失败" + ",操作人:" + CurrentUser.UserData.F_UserCode);
764
+                    return Error("失败" + ",操作人:" + customername);
734 765
                 }
735 766
 
736 767
             }
737
-            return Success("入库成功" + ",操作人:" + CurrentUser.UserData.F_UserCode);
768
+            return Success("入库成功" + ",操作人:" + customername);
738 769
         }
770
+    
739 771
         /// <summary>
740
-        /// 内部员工出库
772
+        /// PC内部员工出库
741 773
         /// </summary>
742 774
         /// <param name="archive"></param>
743 775
         /// <returns></returns>
744
-        public ActionResult insideOperationCk(string archivesids)
776
+        public ActionResult insideOperationCk(string archivesids, string openid)
745 777
         {
746 778
             var model = new CallCenterApi.Model.insideOperation();
747
-            
748
-             ///修改物资状态为已出库
749
-             //根据状态名称 已出库 获取状态id
750
-             var stateid = 1;
751
-            if (archivesbll.GetStateid("已出库") !=0)
779
+
780
+            ///修改物资状态为已出库
781
+            //根据状态名称 已出库 获取状态id
782
+            var stateid = 1;
783
+            if (archivesbll.GetStateid("已出库") != 0)
752 784
             {
753 785
                 stateid = archivesbll.GetStateid("已出库");
754 786
             }
787
+            //获取用户名称
788
+            var customername = "";
789
+            if (openid != null)
790
+            {
791
+                if (archivesbll.GetCustomerName(openid) != "")
792
+                {
793
+                    customername = archivesbll.GetCustomerName(openid);
794
+                }
795
+            }
796
+            else
797
+            {
798
+                customername = CurrentUser.UserData.F_UserCode;
799
+            }
800
+            if (archivesids == null)
801
+                return Error("编号为空" + ",操作人:" + customername);
755 802
             //将多个物品id数据转成数据格式
756 803
             string[] arrStr = archivesids.Split(',');
757 804
             foreach (var item in arrStr)
@@ -761,12 +808,12 @@ namespace CallCenterApi.Interface.Controllers.archives
761 808
                 model.archivesid = Convert.ToInt32(item);//物品编号
762 809
                 model.Warehousing = "出库";//区分入库还是出库
763 810
                 model.WarehousingDate = DateTime.Now;//操作时间
764
-                model.Operator = CurrentUser.UserData.F_UserCode;// CurrentUser.UserData.F_UserCode; //操作人insideOperation.Operator
811
+                model.Operator = customername;// CurrentUser.UserData.F_UserCode; //操作人insideOperation.Operator
765 812
                 var arvichid = Convert.ToInt32(item);
766 813
                 if (archivesbll.AddinsideOperation(model) > 0)
767 814
                 {
768 815
                     var Operationlogmodel = new CallCenterApi.Interface.Models.Input.OperationlogInput();
769
-                    Operationlogmodel.Operator = CurrentUser.UserData.F_UserCode;
816
+                    Operationlogmodel.Operator = customername;
770 817
                     Operationlogmodel.OperationDate = DateTime.Now;
771 818
                     Operationlogmodel.OperationContent = "添加了一条出库信息";
772 819
                     Operationlogmodel.archivesid = arvichid;
@@ -775,10 +822,10 @@ namespace CallCenterApi.Interface.Controllers.archives
775 822
                 }
776 823
                 else
777 824
                 {
778
-                    return Error("失败" + ",操作人:" + CurrentUser.UserData.F_UserCode);
825
+                    return Error("失败" + ",操作人:" + customername);
779 826
                 }
780 827
             }
781
-            return Success("出库成功" + ",操作人:" + CurrentUser.UserData.F_UserCode);
828
+            return Success("出库成功" + ",操作人:" + customername);
782 829
         }
783 830
         /// <summary>
784 831
         /// 删除一条内部员工出入库信息