Ejemplo n.º 1
0
        public JsonResult _Edit(Guid UploadOrderId, string htCode, string MMCoEImageOne, string MMCoEImageTwo, string MMCoEImageThree, int FileType, int IsAttentSame, string AttentSameReason, string SpecialReason, int IsAddFile, int IsMeetingInfoSame, string MeetingInfoSameReason, string Memo)
        {
            //用户信息
            P_USERINFO userInfo        = Session[MealH5.Util.ConstantHelper.CURRENTWXUSER] as P_USERINFO;
            var        uploadChannel   = UploadOrderApiClientChannelFactory.GetChannel();
            var        userInfoChannel = UserInfoClientChannelFactory.GetChannel();
            var        orderChannel    = OrderApiClientChannelFactory.GetChannel();
            //DM
            var uploadInfo = uploadChannel.FindApproveInfo(userInfo.UserId);

            if (uploadInfo == null || uploadInfo.UserId == null)
            {
                return(Json(new { state = 0, txt = "您的直线经理信息有误,请隔日再尝试提交。", errCode = 6666 }));
            }

            var uploadInfoDMDelegate = userInfoChannel.isAgent(uploadInfo.UserId);
            //RM
            var            uploaderRMInfo     = new WP_QYUSER();
            var            uploaderRDInfo     = new WP_QYUSER();
            P_UserDelegate uploaderRDDelegate = null;

            if (uploadInfo != null && uploadInfo.UserId != null)
            {
                uploaderRMInfo = uploadChannel.FindApproveInfo(uploadInfo.UserId);

                if (uploaderRMInfo != null && uploaderRMInfo.UserId != null)
                {
                    //RD/SD
                    uploaderRDInfo     = uploadChannel.FindApproveInfo(uploaderRMInfo.UserId);
                    uploaderRDDelegate = userInfoChannel.isAgent(uploaderRDInfo.UserId);
                }
            }

            var uploadOrderInfo = uploadChannel.LoadPreUploadOrder(UploadOrderId);
            var orderInfo       = orderChannel.FindOrderByCN(htCode);

            uploadOrderInfo.ModifyDate            = DateTime.Now;                                                                                                                                                                                              //修改日期
            uploadOrderInfo.State                 = "1";
            uploadOrderInfo.BUHeadName            = FileType == 2 ? (uploaderRDDelegate == null ? uploaderRDInfo.Name : uploaderRDDelegate.DelegateUserName) : (uploadInfoDMDelegate == null ? uploadInfo.Name : uploadInfoDMDelegate.DelegateUserName);       //审批人姓名
            uploadOrderInfo.BUHeadMUDID           = FileType == 2 ? (uploaderRDDelegate == null ? uploaderRDInfo.UserId : uploaderRDDelegate.DelegateUserMUDID) : (uploadInfoDMDelegate == null ? uploadInfo.UserId : uploadInfoDMDelegate.DelegateUserMUDID); //审批人ID
            uploadOrderInfo.MMCoEImageOne         = MMCoEImageOne;                                                                                                                                                                                             //上传文件1
            uploadOrderInfo.MMCoEImageTwo         = MMCoEImageTwo;                                                                                                                                                                                             //上传文件2
            uploadOrderInfo.MMCoEImageThree       = MMCoEImageThree;                                                                                                                                                                                           //上传文件2
            uploadOrderInfo.IsAttentSame          = IsAttentSame;
            uploadOrderInfo.AttentSameReason      = AttentSameReason;
            uploadOrderInfo.SpecialReason         = SpecialReason;
            uploadOrderInfo.IsAddFile             = IsAddFile;
            uploadOrderInfo.IsMeetingInfoSame     = IsMeetingInfoSame;
            uploadOrderInfo.MeetingInfoSameReason = MeetingInfoSameReason;
            uploadOrderInfo.Memo = Memo;
            if (orderInfo.IsTransfer == 1)
            {
                uploadOrderInfo.IsTransfer            = orderInfo.IsTransfer;
                uploadOrderInfo.TransferUserName      = orderInfo.TransferUserName;
                uploadOrderInfo.TransferUserMUDID     = orderInfo.TransferUserMUDID;
                uploadOrderInfo.TransferOperatorName  = orderInfo.TransferOperatorName;
                uploadOrderInfo.TransferOperatorMUDID = orderInfo.TransferOperatorMUDID;
                uploadOrderInfo.TransferOperateDate   = orderInfo.TransferOperateDate;
            }
            uploadChannel.Update(uploadOrderInfo);
            P_OrderApproveHistory history = new P_OrderApproveHistory()
            {
                ID          = Guid.NewGuid(),
                PID         = UploadOrderId,
                UserName    = CurrentWxUser.Name,
                UserId      = CurrentWxUser.UserId,
                ActionType  = 4,
                ApproveDate = DateTime.Now,
                type        = 2
            };

            uploadChannel.AddOrderApproveHistory(history);

            WxMessageHandler.GetInstance().SendOrderStateChangeMessageToUser(uploadOrderInfo);
            return(Json(new { state = 1 }));
        }
Ejemplo n.º 2
0
        public JsonResult _Submit(string htCode, string MMCoEImageOne, string MMCoEImageTwo, string MMCoEImageThree, int FileType, int IsAttentSame, string AttentSameReason, string SpecialReason, int IsAddFile, int IsMeetingInfoSame, string MeetingInfoSameReason, string Memo)
        {
            //用户信息
            P_USERINFO userInfo        = Session[MealH5.Util.ConstantHelper.CURRENTWXUSER] as P_USERINFO;
            var        uploadChannel   = UploadOrderApiClientChannelFactory.GetChannel();
            var        userInfoChannel = UserInfoClientChannelFactory.GetChannel();
            var        orderChannel    = OrderApiClientChannelFactory.GetChannel();
            //DM
            var uploadInfo = uploadChannel.FindApproveInfo(userInfo.UserId);


            if (uploadInfo == null || uploadInfo.UserId == null)
            {
                return(Json(new { state = 0, txt = "您的直线经理信息有误,请隔日再尝试提交。", errCode = 6666 }));
            }

            var uploadInfoDMDelegate = userInfoChannel.isAgent(uploadInfo.UserId);
            //RM
            var            uploaderRMInfo     = new WP_QYUSER();
            var            uploaderRDInfo     = new WP_QYUSER();
            P_UserDelegate uploaderRDDelegate = null;

            if (uploadInfo != null && uploadInfo.UserId != null)
            {
                uploaderRMInfo = uploadChannel.FindApproveInfo(uploadInfo.UserId);

                if (uploaderRMInfo != null && uploaderRMInfo.UserId != null)
                {
                    //RD/SD
                    uploaderRDInfo     = uploadChannel.FindApproveInfo(uploaderRMInfo.UserId);
                    uploaderRDDelegate = userInfoChannel.isAgent(uploaderRDInfo.UserId);
                }
            }

            var orderInfo   = orderChannel.FindOrderByCN(htCode);
            var orderUpload = new P_PREUPLOADORDER();

            orderUpload.ID                    = Guid.NewGuid();
            orderUpload.ApplierName           = orderInfo.IsTransfer == 0 ? userInfo.Name : orderInfo.Consignee;                                                                                                                                           //登录人姓名
            orderUpload.ApplierMUDID          = orderInfo.IsTransfer == 0 ? userInfo.UserId : orderInfo.UserId;                                                                                                                                            //登录人ID
            orderUpload.CreateDate            = DateTime.Now;                                                                                                                                                                                              //创建日期
            orderUpload.ModifyDate            = orderUpload.CreateDate;                                                                                                                                                                                    //修改日期
            orderUpload.HTCode                = htCode;                                                                                                                                                                                                    //HT编号
            orderUpload.BUHeadName            = FileType == 2 ? (uploaderRDDelegate == null ? uploaderRDInfo.Name : uploaderRDDelegate.DelegateUserName) : (uploadInfoDMDelegate == null ? uploadInfo.Name : uploadInfoDMDelegate.DelegateUserName);       //审批人姓名
            orderUpload.BUHeadMUDID           = FileType == 2 ? (uploaderRDDelegate == null ? uploaderRDInfo.UserId : uploaderRDDelegate.DelegateUserMUDID) : (uploadInfoDMDelegate == null ? uploadInfo.UserId : uploadInfoDMDelegate.DelegateUserMUDID); //审批人ID
            orderUpload.IsReAssign            = false;                                                                                                                                                                                                     //是否重新分配
            orderUpload.State                 = "1";                                                                                                                                                                                                       //状态
            orderUpload.MMCoEImageOne         = MMCoEImageOne;                                                                                                                                                                                             //上传文件1
            orderUpload.MMCoEImageTwo         = MMCoEImageTwo;                                                                                                                                                                                             //上传文件2
            orderUpload.MMCoEImageThree       = MMCoEImageThree;                                                                                                                                                                                           //上传文件2
            orderUpload.FileType              = FileType;
            orderUpload.IsAttentSame          = IsAttentSame;
            orderUpload.AttentSameReason      = AttentSameReason;
            orderUpload.SpecialReason         = SpecialReason;
            orderUpload.IsAddFile             = IsAddFile;
            orderUpload.IsMeetingInfoSame     = IsMeetingInfoSame;
            orderUpload.MeetingInfoSameReason = MeetingInfoSameReason;
            orderUpload.Memo                  = Memo;
            if (orderInfo.IsTransfer == 1)
            {
                orderUpload.IsTransfer            = orderInfo.IsTransfer;
                orderUpload.TransferUserName      = orderInfo.TransferUserName;
                orderUpload.TransferUserMUDID     = orderInfo.TransferUserMUDID;
                orderUpload.TransferOperatorName  = orderInfo.TransferOperatorName;
                orderUpload.TransferOperatorMUDID = orderInfo.TransferOperatorMUDID;
                orderUpload.TransferOperateDate   = orderInfo.TransferOperateDate;
            }
            var res = uploadChannel.Add(orderUpload);

            if (res > 0)
            {
                P_OrderApproveHistory history = new P_OrderApproveHistory()
                {
                    ID          = Guid.NewGuid(),
                    PID         = orderUpload.ID,
                    UserName    = userInfo.Name,
                    UserId      = userInfo.UserId,
                    ActionType  = 1,
                    ApproveDate = DateTime.Now,
                    type        = 2
                };
                uploadChannel.AddOrderApproveHistory(history);
                WxMessageHandler.GetInstance().SendOrderStateChangeMessageToUser(orderUpload);
                return(Json(new { state = 1 }));
            }
            if (res == 0)
            {
                return(Json(new { state = 0, txt = "您的文件已经提交过,请勿重复提交。", errCode = 5555 }));
            }
            else
            {
                return(Json(new { state = 0 }));
            }
        }