AcsApiApp.cs 1.97 KB
using System;
using WebRepository;

namespace WebApp
{
    /// <summary>
    /// 基础数据接口App
    /// </summary>

    public partial class AcsApiApp : ApiApp
    {
        public AcsApiApp(IUnitWork unitWork, IAuth auth, BaseDbContext context) : base(unitWork, auth, context)
        {
        }

        public void TaskRefresh(TaskRefreshModel taskRefreshModel)
        {
            //_unitWork.Update<TTaskAssign>(u => u.Taskno == taskRefreshModel.TaskNo, u => new TTaskAssign { Status = taskRefreshModel.Status, UpdateTime = DateTime.Now, UpdateBy = "RCS"  });
            //AcsTask acsTask = _unitWork.FindSingle<AcsTask>(u => u.TaskNo.Equals(taskRefreshModel.TaskNo));
            TTaskAssign acsTask = _unitWork.FindSingle<TTaskAssign>(u => u.Taskno.Equals(taskRefreshModel.TaskNo));
            if (acsTask != null)
            {
                acsTask.Status = taskRefreshModel.Status;
                _unitWork.Update(acsTask);
                //if (taskRefreshModel.Status == 99)
                //{
                //    AcsTaskHis acsTaskHis = acsTask.CopyTo<AcsTaskHis>();
                //    acsTaskHis.Id = null;
                //    _unitWork.Add(acsTaskHis);
                //    _unitWork.Delete(acsTask);
                //}
            }
        }

        public void ToWebTaskReturn(ToWebTaskReturnModel toWebTaskReturnModel)
        {
            TTaskDesign taskDesign = _unitWork.FindSingle<TTaskDesign>(u => u.Taskid.Equals(toWebTaskReturnModel.TaskID));

            TTaskAssign taskAssign = new TTaskAssign
            {
                Taskno = toWebTaskReturnModel.TaskNo,
                Taskid = toWebTaskReturnModel.TaskID,
                Typename = taskDesign.Typename,
                Groupname = toWebTaskReturnModel.TaskGroup,
                TaskLevel = toWebTaskReturnModel.TaskLevel,
                Status = 1,
                CreateBy = "acs",
                CreateTime = DateTime.Now,
            };
            _unitWork.Add(taskAssign);
        }
    }
}