Example #1
0
        public ActionResult RecordBorrowReturn(string borrowId)
        {
            //var result = BorrowHistoryService.ReturnBorrowFile(borrowId);
            var recordList = ApplyBorrowFileListService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).ToList();
            var apply      = ApplyBorrowService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).First();

            apply.ApplyState = 4;
            ApplyBorrowService.UpdateModel(apply);
            //if(result)
            //{
            foreach (var item in recordList)
            {
                var operate = new OperateLog()
                {
                    RecordId      = item.RecordID,
                    OperatePeople = Operator.RealName,
                    OperateTime   = DateTime.Now,
                    OperateType   = "借阅档案归还确认",
                    OperateInfo   = $"外借档案借阅归还 档案号:{item.RecordID}"
                };
                var record = recordService.GetByWhere(" where RecordID=@RecordID", new { RecordID = item.RecordID })
                             .First();
                record.RecordStatus = 2;
                recordService.UpdateModel(record);
                OperateLogService.CreateModel(operate);
            }
            return(Json(SuccessTip("外借档案归还成功!")));
            //}
            //else
            //{
            //return Json(ErrorTip("外借档案归还失败,请重试!"));
            //}
        }
Example #2
0
        public ActionResult ReturnListDetail(string borrowId)
        {
            var borrowRecordList = ApplyBorrowFileListService
                                   .GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).Select(item => item.RecordID)
                                   .ToList();

            var html = "";

            foreach (var recordId in borrowRecordList)
            {
                var record        = recordService.GetRecord(recordId);
                var typeList      = ContractFileType.GetListByRecordId(recordId);
                var fileList      = recordService.GetRecordListByRecordId(recordId);
                var otherFileList = recordService.GetOtherFileListByRecordId(recordId);

                html += "<fieldset class='layui-elem-field layui-field-title' style='margin-top:20px;'>" +
                        "<legend>" + record.RecordUserName + "</legend>" +
                        "</fieldset><div style='padding: 20px; background-color: #F2F2F2;'>";
                foreach (var type in typeList)
                {
                    html += "<div class=\"layui-card\">" +
                            "<div class=\"layui-card-header\">" + type.RecordTypeName + " " + type.HoldingCell + "</div>" +
                            "<div class=\"layui-card-body\">" +
                            "<div class=\"layui-fluid\">";

                    foreach (var temp in fileList.Where(item => item.RecordType == type.ID))
                    {
                        var time = temp.ExpirationTime == null
                            ? "无过期时间"
                            : temp.ExpirationTime.GetValueOrDefault().ToString("yyyy-MM-dd");
                        html += "<div class=\"layui-row\" style=\"text-align: center;\">" +
                                "<div class=\"layui-col-xs4\">" + temp.RecordFileName + "</div>" +
                                "<div class=\"layui-col-xs4\">" + time + "</div>" +
                                "<div class=\"layui-col-xs4\">x" + temp.Amount + "</div>" +
                                "</div>";
                    }

                    foreach (var temp in otherFileList.Where(item => item.RecordFileType == type.ID))
                    {
                        var time = temp.ExpirationTime == null
                            ? "无过期时间"
                            : temp.ExpirationTime.GetValueOrDefault().ToString("yyyy-MM-dd");
                        html += "<div class=\"layui-row\" style=\"text-align: center;\">" +
                                "<div class=\"layui-col-xs4\">" + temp.FileName + "</div>" +
                                "<div class=\"layui-col-xs4\">" + time + "</div>" +
                                "<div class=\"layui-col-xs4\">x" + temp.Amount + "</div>" +
                                "</div>";
                    }

                    html += "</div></div></div>";
                }

                html += "</div>";
            }

            ViewBag.html = html;
            return(View("RecordReturn"));
        }
Example #3
0
        public ActionResult ReApplyBorrow(string borrowId)
        {
            try
            {
                var result           = ApplyBorrowService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).First();
                var borrowRecordList = ApplyBorrowFileListService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).ToList();
                if (result.ApplyState == 3)
                {
                    result.ApplyState = 1;
                    var sign = ApplyBorrowService.UpdateModel(result);

                    if (sign)
                    {
                        foreach (var item in borrowRecordList)
                        {
                            var operate = new OperateLog()
                            {
                                OperatePeople = Operator.RealName,
                                OperateTime   = DateTime.Now,
                                OperateType   = "重新申请借阅",
                                RecordId      = item.RecordID,
                                OperateInfo   = $"重新申请借阅 借阅编号:{result.BorrowID},档案编号:{item.RecordID}"
                            };
                            OperateLogService.CreateModel(operate);
                        }
                        return(Json(SuccessTip("重新申请借阅成功!")));
                    }
                    else
                    {
                        return(Json(ErrorTip("重新申请借阅失败!")));
                    }
                }
                else
                {
                    return(Json(ErrorTip("当前申请状态不允许重新申请!")));
                }
            }
            catch (InvalidOperationException ex)
            {
                Log.WriteFatal(ex);
                return(Json(ErrorTip("重新申请借阅失败,当前借阅编号不存在!")));
            }
        }
Example #4
0
        public ActionResult ApplyBorrowAgree(string borrowId)
        {
            try
            {
                var applyBorrow = ApplyBorrowService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId })
                                  .First();
                applyBorrow.ApplyState = 2;
                var result     = ApplyBorrowService.UpdateModel(applyBorrow);
                var editResult = ApplyBorrowService.ApplyBorrowAgree(borrowId);

                if (result && editResult)
                {
                    var applyRecordList = ApplyBorrowFileListService
                                          .GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).ToList();

                    foreach (var record in applyRecordList)
                    {
                        var operate = new OperateLog()
                        {
                            OperateTime   = DateTime.Now,
                            OperateType   = "审批借阅",
                            OperatePeople = Operator.RealName,
                            RecordId      = record.RecordID
                        };
                        operate.OperateInfo += $"档案编号:{record.RecordID} 申请借阅审核通过";
                        OperateLogService.CreateModel(operate);
                    }

                    return(Json(SuccessTip("申请借阅审核成功!")));
                }
                else
                {
                    return(Json(ErrorTip("申请借阅审核失败!")));
                }
            }
            catch (InvalidOperationException ex)
            {
                Log.WriteFatal(ex);
                return(Json(ErrorTip("获取不到申请借阅记录,出现数据一致性错误!")));
            }
        }