375 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			375 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using APT.BaseData.Domain.Entities;
 | 
						|
using APT.BaseData.Domain.Entities.FM;
 | 
						|
using APT.BaseData.Domain.Enums;
 | 
						|
using APT.BaseData.Domain.Enums.PF;
 | 
						|
using APT.BaseData.Domain.IServices;
 | 
						|
using APT.BaseData.Domain.IServices.FM;
 | 
						|
using APT.BaseData.Services.Services.FM;
 | 
						|
using APT.Infrastructure.Core;
 | 
						|
using APT.MS.Domain.Entities.DM;
 | 
						|
using APT.MS.Domain.Entities.FO;
 | 
						|
using APT.MS.Domain.Entities.SC.DM;
 | 
						|
using APT.MS.Domain.Entities.SC.PR;
 | 
						|
using APT.MS.Domain.Enums;
 | 
						|
using APT.Utility;
 | 
						|
using Autofac.Core;
 | 
						|
using Microsoft.AspNetCore.Mvc;
 | 
						|
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Linq;
 | 
						|
namespace APT.SC.WebApi.Controllers.Api.DMController
 | 
						|
{
 | 
						|
    /// <summary>
 | 
						|
    ///  设备设施库采购记录
 | 
						|
    /// </summary>
 | 
						|
    [Route("api/DM/DMDevicePurchase")]
 | 
						|
    public partial class DevicePurchaseController : AuthorizeApiController<T_DM_DEVICE_PURCHASE>
 | 
						|
    {
 | 
						|
        IPFCodeRuleService CodeRuleService { get; set; }
 | 
						|
        IFMNotificationTaskService NotificationTaskService { get; set; }
 | 
						|
        IFMFlowPermitService MFlowPermitService { get; set; }
 | 
						|
        IPFApproveCallBackService ApproveCallBackService { get; set; }
 | 
						|
        /// <summary>
 | 
						|
        /// 设备设施采购
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="notificationTaskService"></param>
 | 
						|
        public DevicePurchaseController(IPFCodeRuleService codeRuleService, IFMNotificationTaskService notificationTaskService, IFMFlowPermitService mFlowPermitService, IPFApproveCallBackService approveCallBackService)
 | 
						|
        {
 | 
						|
            CodeRuleService = codeRuleService;
 | 
						|
            NotificationTaskService = notificationTaskService;
 | 
						|
            MFlowPermitService = mFlowPermitService;
 | 
						|
            ApproveCallBackService = approveCallBackService;
 | 
						|
        }
 | 
						|
        /// <summary>
 | 
						|
        /// 新增/编辑
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="entity"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpPost, Route("FullUpdateUser")]
 | 
						|
        public JsonActionResult<bool> FullUpdateUser([FromBody] T_DM_DEVICE_PURCHASE entity)
 | 
						|
        {
 | 
						|
            return SafeExecute(() =>
 | 
						|
            {
 | 
						|
                if (string.IsNullOrEmpty(entity.CODE))
 | 
						|
                    entity.CODE = DateTime.Now.Year.ToString().PadLeft(4, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0') + new Random().Next().ToString();
 | 
						|
                var details = entity.Nav_Details;
 | 
						|
                entity.Nav_Details = null;
 | 
						|
                var loginUserId = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
 | 
						|
                if (entity.TaskID != Guid.Empty)
 | 
						|
                {
 | 
						|
                    var currTask = GetEntity<T_FM_NOTIFICATION_TASK>(t => t.ID == entity.TaskID);
 | 
						|
                    if (currTask != null)
 | 
						|
                    {
 | 
						|
                        loginUserId = currTask.USER_ID;
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                List<T_DM_DEVICE_PURCHASE_DETAIL_FILE> fileList = new List<T_DM_DEVICE_PURCHASE_DETAIL_FILE>(); 
 | 
						|
                List<T_DM_DEVICE_PURCHASE_DETAIL_RECEIPT_FILE> receiptFileList = new List<T_DM_DEVICE_PURCHASE_DETAIL_RECEIPT_FILE>();
 | 
						|
                List<Guid> deletefileList = new List<Guid>();
 | 
						|
                List<Guid> deleteReceiptFileList = new List<Guid>();
 | 
						|
                List<Guid> deleteDetailList = new List<Guid>();
 | 
						|
                T_FM_NOTIFICATION_TASK task = null;
 | 
						|
                if (details != null && details.Any())
 | 
						|
                {
 | 
						|
                    var userManageIds= details.Select(t=>t.MANAGE_USER_ID).Distinct().ToList();
 | 
						|
                    var users = this.GetEntities<T_FM_USER>(t => userManageIds.Contains(t.ID) && t.ENABLE_STATUS == 0, new BaseFilter(entity.ORG_ID),"Nav_Person");
 | 
						|
                    deleteDetailList = details.Select(t => t.ID).ToList();
 | 
						|
                    var files = this.GetEntities<T_DM_DEVICE_PURCHASE_DETAIL_FILE>(t => deleteDetailList.Contains(t.DEVICE_PURCHASE_DETAIL_ID), new BaseFilter(entity.ORG_ID)).ToList();
 | 
						|
                    deletefileList = files.Select(t => t.ID).ToList();
 | 
						|
                    var receiptFiles = this.GetEntities<T_DM_DEVICE_PURCHASE_DETAIL_RECEIPT_FILE>(t => deleteDetailList.Contains(t.DEVICE_PURCHASE_DETAIL_ID), new BaseFilter(entity.ORG_ID)).ToList();
 | 
						|
                    deleteReceiptFileList = receiptFiles.Select(t => t.ID).ToList();
 | 
						|
                    details.ForEach(t =>
 | 
						|
                    {
 | 
						|
                        t.ORG_ID = entity.ORG_ID; t.DEVICE_PURCHASE_ID = entity.ID; t.USER_ID = loginUserId;
 | 
						|
                        if (t.Nav_Files != null && t.Nav_Files.Any())
 | 
						|
                        {
 | 
						|
                            t.Nav_Files.ForEach(m =>
 | 
						|
                            {
 | 
						|
                                m.ORG_ID = entity.ORG_ID; m.DEVICE_PURCHASE_DETAIL_ID = t.ID;
 | 
						|
                                //deletefileList.Add(m.ID);
 | 
						|
                                fileList.Add(m);
 | 
						|
                            });
 | 
						|
                            t.Nav_Files = null;
 | 
						|
                        }
 | 
						|
                        if (t.Nav_ReceiptFiles != null && t.Nav_ReceiptFiles.Any())
 | 
						|
                        {
 | 
						|
                            t.Nav_ReceiptFiles.ForEach(m =>
 | 
						|
                            {
 | 
						|
                                m.ORG_ID = entity.ORG_ID; m.DEVICE_PURCHASE_DETAIL_ID = t.ID;
 | 
						|
                                //deleteReceiptFileList.Add(m.ID);
 | 
						|
                                receiptFileList.Add(m);
 | 
						|
                            });
 | 
						|
                            t.Nav_ReceiptFiles = null;
 | 
						|
                        }
 | 
						|
                        if (t.MANAGE_USER_ID != null)
 | 
						|
                        { 
 | 
						|
                            t.DEPARTMENT_ID = users.FirstOrDefault(u => u.ID == t.MANAGE_USER_ID)?.DEPARTMENT_ID;
 | 
						|
                            t.POST_ID = users.FirstOrDefault(u => u.ID == t.MANAGE_USER_ID)?.Nav_Person?.POST_ID;
 | 
						|
                        }
 | 
						|
                    });
 | 
						|
                }
 | 
						|
                if (entity.PUBLISH != null && entity.PUBLISH.Equals("SaveAndNotify"))
 | 
						|
                {
 | 
						|
                    var model = this.GetEntity<T_DM_DEVICE_PURCHASE>(entity.ID, "Nav_Details");
 | 
						|
                    //待所有设备都填写完后再提交审批
 | 
						|
                    var qty = (model != null && model.Nav_Details.Any()) ? model.Nav_Details.Where(t => t.DEAL_STATUS == 0).Count() : 0;
 | 
						|
                    if (qty <= 1)
 | 
						|
                    {
 | 
						|
                        details.ForEach(t =>
 | 
						|
                        {
 | 
						|
                            t.DEAL_STATUS = 1;
 | 
						|
                        });
 | 
						|
                        entity.STATUS = PFStandardStatus.Approving;
 | 
						|
                        //取审批流水码
 | 
						|
                        var sysFilter = new SystemCodeFilter();
 | 
						|
                        sysFilter.CodeType = (int)PFCodeRuleType.审批流编码;
 | 
						|
                        sysFilter.Count = 1;
 | 
						|
                        sysFilter.OrgId = entity.ORG_ID;
 | 
						|
                        var codes = CodeRuleService.NewGenSerial(sysFilter);
 | 
						|
                        var serialCode = codes.Split(new char[] { ',' });
 | 
						|
                        MFlowPermitService.InsertApprove(serialCode[0], "DM036", "", entity.ID, "DM036_SHOWPRINT", entity.TaskID, true, () =>
 | 
						|
                        {
 | 
						|
                            if (deletefileList != null && deletefileList.Any())
 | 
						|
                                this.BantchDeleteEntityNoCommit<T_DM_DEVICE_PURCHASE_DETAIL_FILE>(deletefileList);
 | 
						|
                            if (deleteReceiptFileList != null && deleteReceiptFileList.Any())
 | 
						|
                                this.BantchDeleteEntityNoCommit<T_DM_DEVICE_PURCHASE_DETAIL_RECEIPT_FILE>(deleteReceiptFileList);
 | 
						|
                            if (entity != null)
 | 
						|
                                this.UpdateEntityNoCommit(entity);
 | 
						|
                            if (details != null && details.Any())
 | 
						|
                                this.BantchSaveEntityNoCommit(details);
 | 
						|
                            if (fileList != null && fileList.Any())
 | 
						|
                                this.BantchSaveEntityNoCommit(fileList);
 | 
						|
                            if (receiptFileList != null && receiptFileList.Any())
 | 
						|
                                this.BantchSaveEntityNoCommit(receiptFileList);
 | 
						|
                        }, null, null, null, null, null, "DM036_SHOWPRINT", null, "设备设施申购表采购信息待审批", FMTASKTYPE.JobSite);
 | 
						|
                        return true;
 | 
						|
                    }
 | 
						|
                    else
 | 
						|
                    {
 | 
						|
                        if (entity.TaskID != Guid.Empty)
 | 
						|
                        {
 | 
						|
                            task = NotificationTaskService.GetTaskFinishModel(entity.TaskID);
 | 
						|
                            task.SOURCE_FORMCODE = "DM036_SHOWPRINT";
 | 
						|
                        }
 | 
						|
                        details.ForEach(t =>
 | 
						|
                        {
 | 
						|
                            t.DEAL_STATUS = 1;
 | 
						|
                        });
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                UnifiedCommit(() =>
 | 
						|
                {
 | 
						|
                    if (entity != null)
 | 
						|
                        this.UpdateEntityNoCommit(entity);
 | 
						|
                    if (deletefileList != null && deletefileList.Any())
 | 
						|
                        this.BantchDeleteEntityNoCommit<T_DM_DEVICE_PURCHASE_DETAIL_FILE>(deletefileList);
 | 
						|
                    if (deleteReceiptFileList != null && deleteReceiptFileList.Any())
 | 
						|
                        this.BantchDeleteEntityNoCommit<T_DM_DEVICE_PURCHASE_DETAIL_RECEIPT_FILE>(deleteReceiptFileList);
 | 
						|
                    if (details != null && details.Any())
 | 
						|
                        this.BantchSaveEntityNoCommit(details);
 | 
						|
                    if (fileList != null && fileList.Any())
 | 
						|
                        this.BantchSaveEntityNoCommit(fileList);
 | 
						|
                    if (receiptFileList != null && receiptFileList.Any())
 | 
						|
                        this.BantchSaveEntityNoCommit(receiptFileList);
 | 
						|
                    if (task != null)
 | 
						|
                        this.UpdateEntityNoCommit(task);
 | 
						|
                });
 | 
						|
                return true;
 | 
						|
            });
 | 
						|
        }
 | 
						|
        /// <summary>
 | 
						|
        /// 采购专员获取
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="filter"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpPost, Route("GetUserEdit")]
 | 
						|
        public JsonActionResult<T_DM_DEVICE_PURCHASE> GetUserEdit([FromBody] KeywordFilter filter)
 | 
						|
        {
 | 
						|
            return SafeExecute(() => {
 | 
						|
                var id = filter.FilterGroup.Rules.FirstOrDefault(t => t.Field == "ID").Value.ToString();
 | 
						|
                if (string.IsNullOrEmpty(id))
 | 
						|
                    this.ThrowError("030017");
 | 
						|
                var result = this.GetEntity<T_DM_DEVICE_PURCHASE>(id, new string[] { "Nav_User", "Nav_Department","Nav_Details","Nav_Details.Nav_Type",
 | 
						|
                    "Nav_Details.Nav_Device","Nav_Details.Nav_Files","Nav_Details.Nav_Files.Nav_ImgFile","Nav_Details.Nav_ReceiptFiles", 
 | 
						|
                    "Nav_Details.Nav_ManageUser","Nav_Details.Nav_ReceiptFiles.Nav_ImgFile","Nav_Details.Nav_Department","Nav_Details.Nav_Post",
 | 
						|
                    "Nav_Details.Nav_Category"});
 | 
						|
                if (result != null && result.Nav_Details != null)
 | 
						|
                {
 | 
						|
                    var loginUserId = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
 | 
						|
                    result.Nav_Details = result.Nav_Details.Where(t => t.USER_ID == loginUserId).ToList();
 | 
						|
                }
 | 
						|
                return result;
 | 
						|
            });
 | 
						|
        }
 | 
						|
        /// <summary>
 | 
						|
        /// 部门级负责人审阅
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="model"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpPost, Route("IdentityUpdate")]
 | 
						|
        public JsonActionResult<bool> IdentityUpdate([FromBody] T_DM_DEVICE_PURCHASE model)
 | 
						|
        {
 | 
						|
            return SafeExecute(() =>
 | 
						|
            {
 | 
						|
                var entity = this.GetEntity<T_DM_DEVICE_PURCHASE>(model.ID, "Nav_Details.Nav_Files", "Nav_Details.Nav_ReceiptFiles");
 | 
						|
                entity.STATUS = PFStandardStatus.Archived;
 | 
						|
                var users = this.GetEntities<T_FM_USER>(t => t.ENABLE_STATUS == 0, new BaseFilter(entity.ORG_ID), "Nav_Person");
 | 
						|
                List<T_FM_NOTIFICATION_TASK> sendNotices = new List<T_FM_NOTIFICATION_TASK>();
 | 
						|
                T_DM_DEVICE_APPLY apply = null;
 | 
						|
                List<T_DM_DEVICE_APPLY_DETAIL> detailList = new List<T_DM_DEVICE_APPLY_DETAIL>();
 | 
						|
                //发给申购人一张申领表
 | 
						|
                if (entity.USER_ID != null)
 | 
						|
                {
 | 
						|
                    apply = new T_DM_DEVICE_APPLY();
 | 
						|
                    apply.USER_ID = entity.USER_ID;
 | 
						|
                    apply.DEPARTMENT_ID = entity.DEPARTMENT_ID;
 | 
						|
                    apply.ORG_ID = entity.ORG_ID;
 | 
						|
                    apply.CODE = entity.CODE;
 | 
						|
                    apply.STATUS = PFStandardStatus.Draft;
 | 
						|
                    apply.DEVICE_PURCHASE_ID = entity.ID;
 | 
						|
                    apply.MineType = entity.MineType;
 | 
						|
                    var DMUser = users.FirstOrDefault(t => t.ID == entity.USER_ID);
 | 
						|
                    if (DMUser != null)
 | 
						|
                    {
 | 
						|
                        var sendNotice = NotificationTaskService.InsertUserNoticeTaskModel("设备设施申领表", apply.ID, entity.ORG_ID, DMUser.ID, DMUser.NAME, DateTime.Now,
 | 
						|
                                        DateTime.Now.AddDays(1), (int)FMNoticeTypeEnum.消息, "DM014");
 | 
						|
                        sendNotices.Add(sendNotice);
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                List<T_DM_DEVICE_BASE> deviceList = new List<T_DM_DEVICE_BASE>();
 | 
						|
                List<T_DM_DEVICE_BASE_FILE> fileList = new List<T_DM_DEVICE_BASE_FILE>();
 | 
						|
                List<T_DM_DEVICE_BASE_RECEIPT_FILE> receiptFileList = new List<T_DM_DEVICE_BASE_RECEIPT_FILE>();
 | 
						|
                var deviceIds = entity.Nav_Details.Select(t => t.DEVICE_ID).Distinct().ToList();
 | 
						|
                var devices = this.GetEntities<T_DM_DEVICE>(t => deviceIds.Contains(t.ID), new BaseFilter(entity.ORG_ID));
 | 
						|
                var date = DateTime.Now.Year.ToString().PadLeft(4, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0');
 | 
						|
                //写入设备设施库
 | 
						|
                foreach (var item in entity.Nav_Details)
 | 
						|
                {
 | 
						|
                    if (item.QTY <= 0)
 | 
						|
                        throw new Exception("设备数量必须大于或等于1");
 | 
						|
                    for (var i = 0; i < item.QTY; i++)
 | 
						|
                    {
 | 
						|
                        //var user = users.FirstOrDefault(u => u.ID == item.MANAGE_USER_ID);
 | 
						|
                        var device = new T_DM_DEVICE_BASE();
 | 
						|
                        device.ID = Guid.NewGuid();
 | 
						|
                        device.CODE = date + new Random().Next().ToString();
 | 
						|
                        //int num = i + 1;
 | 
						|
                        device.ORG_ID = entity.ORG_ID;
 | 
						|
                        device.NAME = devices.FirstOrDefault(t => t.ID == item.DEVICE_ID)?.NAME;
 | 
						|
                        string nameHead = DataHelper.MkPinyinString(device.NAME);
 | 
						|
                        device.MACHINE_CODE = nameHead + DateTime.Now.ToString("yyyyMMdd") + new Random().Next().ToString("D6");
 | 
						|
                        device.CATEGORY_ID = item.CATEGORY_ID;
 | 
						|
                        device.TYPE_ID = item.TYPE_ID;
 | 
						|
                        device.IS_EMERGENCY = item.IS_EMERGENCY;
 | 
						|
                        device.PARAMETER = item.PARAMETER;
 | 
						|
                        device.DEVICE_TYPE = item.DEVICE_TYPE;
 | 
						|
                        device.DEVICE_ID = item.DEVICE_ID;
 | 
						|
                        device.SPEC = item.SPEC;
 | 
						|
                        device.UNIT = item.UNIT;
 | 
						|
                        device.QTY = 1;
 | 
						|
                        device.PURCHASE_DATE = item.PURCHASE_DATE;
 | 
						|
                        device.ACCEPT_DATE = item.ACCEPT_DATE;
 | 
						|
                        //device.PURPOSE = item.use;
 | 
						|
                        device.POSITION = item.POSITION;
 | 
						|
                        device.USER_ID = item.MANAGE_USER_ID;
 | 
						|
                        device.DEPARTMENT_ID = item.DEPARTMENT_ID;
 | 
						|
                        device.USER_POST_ID = item.POST_ID;
 | 
						|
                        device.MineType = entity.MineType;
 | 
						|
                        device.DEVICE_STATUS = DMDeviceStatusEnum.库存品;
 | 
						|
                        //device.USE_USER_ID = item.USER_ID;
 | 
						|
                        //device.USE_DEPARTMENT_ID = item.DEPARTMENT_ID;
 | 
						|
                        //device.USE_USER_POST_ID = item.USE_USER_POST_ID;
 | 
						|
                        device.IS_SEND = 1;
 | 
						|
                        device.DEVICE_PURCHASE_ID = item.DEVICE_PURCHASE_ID;
 | 
						|
                        deviceList.Add(device);
 | 
						|
                        if (item.Nav_Files != null && item.Nav_Files.Any())
 | 
						|
                        {
 | 
						|
                            item.Nav_Files.ForEach(t =>
 | 
						|
                            {
 | 
						|
                                T_DM_DEVICE_BASE_FILE file = new T_DM_DEVICE_BASE_FILE();
 | 
						|
                                file.ORG_ID = entity.ORG_ID; file.DEVICE_BASE_ID = device.ID;
 | 
						|
                                file.IMG_FILE_ID = t.IMG_FILE_ID;
 | 
						|
                                fileList.Add(file);
 | 
						|
                            });
 | 
						|
                        }
 | 
						|
                        if (item.Nav_ReceiptFiles != null && item.Nav_ReceiptFiles.Any())
 | 
						|
                        {
 | 
						|
                            item.Nav_ReceiptFiles.ForEach(t =>
 | 
						|
                            {
 | 
						|
                                T_DM_DEVICE_BASE_RECEIPT_FILE file = new T_DM_DEVICE_BASE_RECEIPT_FILE();
 | 
						|
                                file.ORG_ID = entity.ORG_ID; file.DEVICE_BASE_ID = device.ID;
 | 
						|
                                file.IMG_FILE_ID = t.IMG_FILE_ID;
 | 
						|
                                receiptFileList.Add(file);
 | 
						|
                            });
 | 
						|
                        }
 | 
						|
                        if (apply != null)
 | 
						|
                        {
 | 
						|
                            T_DM_DEVICE_APPLY_DETAIL newdata = new T_DM_DEVICE_APPLY_DETAIL();
 | 
						|
                            newdata.DEVICE_APPLY_ID = apply.ID;
 | 
						|
                            newdata.DEVICE_BASE_ID = device.ID;
 | 
						|
                            newdata.ORG_ID = device.ORG_ID;
 | 
						|
                            newdata.SPEC = device.SPEC;
 | 
						|
                            newdata.QTY = device.QTY;
 | 
						|
                            newdata.UNIT = device.UNIT;
 | 
						|
                            detailList.Add(newdata);
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                    
 | 
						|
                }
 | 
						|
                UnifiedCommit(() =>
 | 
						|
                {
 | 
						|
                    if (sendNotices != null && sendNotices.Count > 0)
 | 
						|
                        BantchSaveEntityNoCommit(sendNotices);
 | 
						|
                    if (apply != null)
 | 
						|
                        this.UpdateEntityNoCommit(apply);
 | 
						|
                    if (detailList != null && detailList.Any())
 | 
						|
                        BantchSaveEntityNoCommit(detailList);
 | 
						|
                    if (deviceList != null && deviceList.Any())
 | 
						|
                        BantchSaveEntityNoCommit(deviceList);
 | 
						|
                    if (fileList != null && fileList.Any())
 | 
						|
                        BantchSaveEntityNoCommit(fileList);
 | 
						|
                    if (receiptFileList != null && receiptFileList.Any())
 | 
						|
                        BantchSaveEntityNoCommit(receiptFileList);
 | 
						|
                });
 | 
						|
                return true;
 | 
						|
            });
 | 
						|
        }
 | 
						|
        /// <summary>
 | 
						|
        /// 回调函数
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="entity"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpPost, Route("BackUpdateNew")]
 | 
						|
        public JsonActionResult<bool> BackUpdateNew([FromBody] T_PF_APPROVE entity)
 | 
						|
        {
 | 
						|
            return SafeExecute(() =>
 | 
						|
            {
 | 
						|
                return ApproveCallBackService.CallBackNew("DM/DMDevicePurchase/BackUpdateNew", entity);
 | 
						|
            });
 | 
						|
        }
 | 
						|
        /// <summary>
 | 
						|
        /// 排序分页查询数据
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="pageFilter">分页过滤实体</param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpPost, Route("PostOrderPaged")]
 | 
						|
        public PagedActionResult<T_FM_USER_POST> PostOrderPaged([FromBody] KeywordPageFilter pageFilter)
 | 
						|
        {
 | 
						|
            var result = new PagedActionResult<T_FM_USER_POST>();
 | 
						|
            var filter = pageFilter.FilterGroup.Rules.FirstOrDefault(t => t.Field == "DEPARTMENT_ID");
 | 
						|
            if (filter != null && !string.IsNullOrEmpty(filter.Value.ToString()))
 | 
						|
            {
 | 
						|
                var users = this.GetEntities<T_FM_USER>(t => t.DEPARTMENT_ID == Guid.Parse(filter.Value.ToString()) && t.ENABLE_STATUS == 0 && t.Nav_Person!=null,new BaseFilter(pageFilter.OrgId), "Nav_Person");
 | 
						|
                var postIds = users.Select(t => t.Nav_Person.POST_ID).Distinct().ToList();
 | 
						|
                pageFilter.FilterGroup.Rules.Remove(filter);
 | 
						|
                result = this.GetOrderPageEntities<T_FM_USER_POST>(t => postIds.Contains(t.ID), pageFilter);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                result = this.GetOrderPageEntities<T_FM_USER_POST>(null, pageFilter);
 | 
						|
            }
 | 
						|
            return result;
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |