移动系统liao
14 小时以前 757e9a10418043eb1a5c5e41975d3eb39db66a80
no message
6个文件已修改
373 ■■■■■ 已修改文件
cylsg/cylsg.Application/CyOS/CyOSSDriver.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/CyOS/CyOSSettingController.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/CyOS/CyOSStaffController.cs 163 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs 84 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Model/ECTEModel/OA_CarManage.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Model/ECTEModel/OA_DeliverPlanPaiche.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/CyOS/CyOSSDriver.cs
@@ -47,7 +47,7 @@
            Expression<Func<OA_DeliverPlanPaiche, bool>> SearchList = (x) => true;
            SearchList = SearchList.And(x => x.FirmId == _oAServices.firmId);
            SearchList = SearchList.And(x => x.DriverId == Permissions.KeyId);//只看自己
            SearchList = SearchList.And(x => x.ShifouDelivery != 2);//过滤有效
            SearchList = SearchList.And(x => x.ShifouDelivery != 2 && x.ShifouDelivery != 0);//过滤有效
            if (Param.DeliverKeyID != null)
            {
                SearchList = SearchList.And(x => x.DriverId == Param.DeliverKeyID);
cylsg/cylsg.Application/CyOS/CyOSSettingController.cs
@@ -95,7 +95,7 @@
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public async Task<List<OaStaff>> Getdrivers()
        {
            return await _client.Queryable<OaStaff>().Includes(x=>x.Car).Where(x => x.Status == "在职" && x.FirmId == _oAServices.firmId && x.BF_IsDriver).Select(x => new OaStaff
@@ -109,6 +109,43 @@
        }
        /// <summary>
        /// 获取车辆列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<OA_CarManage>> GetCarList()
        {
            var listdata= await _client.Queryable<OA_CarManage>().Includes(x => x.Staff).Where(x =>  x.MemberID == _oAServices.firmId ).Select(x=>new OA_CarManage
            {
                 Keyid = x.Keyid,
                 CarNumber = x.CarNumber,
                 Staff=x.Staff
            })
           .ToListAsync();
            foreach (var item in listdata)
            {
                if(item.Staff!=null)
                {
                    if (item.Staff.Status != "在职")
                    {
                        item.Mark = "该员工不属于在职状态,派车后可能无法完成后续流程";
                    }
                    if (item.Staff.BF_IsDriver )
                    {
                        item.Mark+= "该员工不是专职司机";
                    }
                    item.CarNumber = item.CarNumber + "(" + item.Staff.Name + ")";
                    item.Staff = null;
                }
                item.StaffID = 0;
            }
            return listdata;
        }
        /// <summary>
        /// 获取7天内司机列表
        /// </summary>
@@ -145,9 +182,25 @@
            ////.ToListAsync();
             }
        /// <summary>
        /// 获取员工列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<OaStaff>>GetStaffList()
        {
            return await _client.Queryable<OaStaff>().Where(x => x.Status == "在职" && x.FirmId == _oAServices.firmId && x.BF_IsDriver).Select(x => new OaStaff
            {
                Name = x.Name,
                MemberId = x.MemberId,
                Keyid = x.Keyid,
            }).WithCache(30).ToListAsync();
        }
        }
}
cylsg/cylsg.Application/CyOS/CyOSStaffController.cs
@@ -13,10 +13,12 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.ConstrainedExecution;
using System.Text;
using System.Threading.Tasks;
using TencentCloud.Hunyuan.V20230901.Models;
using TencentCloud.Mrs.V20200910.Models;
using static SKIT.FlurlHttpClient.Wechat.Api.Models.ProductOfflineGetSameCityTemplateResponse.Types.Template.Types;
namespace cylsg.Application.CyOS
{
@@ -133,7 +135,7 @@
               
                throw Oops.Oh("科目ID RewardResult不能为空");
            }
            OaSubjectSet? kemu = null;
            OaSubjectSet kemu = null;
            try
            {
             var kemuid=     pram.RewardResult.toInt();
@@ -503,7 +505,7 @@
            Expression<Func<OA_DeliverPlanPaiche, bool>> SearchList = (x) => true;
            SearchList = SearchList.And(x => x.FirmId == _OAServices.firmId);
            SearchList = SearchList.And(x => x.BusinessManagerId == Permissions.KeyId);//只看自己 客户经理是自己
            SearchList = SearchList.And(x => x.ShifouDelivery !=2);//过滤有效
            SearchList = SearchList.And(x => x.ShifouDelivery != 2 && x.ShifouDelivery != 0);//过滤有效
            if (Param.DeliverKeyID!=null)
            {
                SearchList = SearchList.And(x => x.DriverId == Param.DeliverKeyID);
@@ -565,10 +567,163 @@
                throw Oops.Oh("没有权限");
            }
            return await _SugarClient.Queryable<OA_DeliverPlanPaiche>().Includes(x => x.Attachments).Includes(x=>x.Driver).Includes(x=>x.DeliverPlans)
                .Where(x => x.BusinessManagerId == Permissions.KeyId && x.Keyid == KeyId && x.ShifouDelivery != 2).FirstAsync();
                .Where(x => x.BusinessManagerId == Permissions.KeyId && x.Keyid == KeyId && x.ShifouDelivery != 2&&x.ShifouDelivery!=0).FirstAsync();
        }
        /// <summary>
        /// 获取问题反馈订单
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<DeliverOderPageRet> GetProblemPlans(DeliverPlanSearchParam Param)
        {
            if (!await CheckRols())
            {
                throw Oops.Oh("没有权限");
            }
            Expression<Func<OA_DeliverPlanPaiche, bool>> SearchList = (x) => true;
            SearchList = SearchList.And(x => x.FirmId == _OAServices.firmId);
            SearchList = SearchList.And(x => x.BusinessManagerId == Permissions.KeyId||x.DriverId==Permissions.KeyId);//只看自己 创建的或者是反馈者是自己的
            SearchList = SearchList.And(x => x.ShifouDelivery ==0);//过滤有效
            if (Param.DeliverKeyID != null)
            {
                SearchList = SearchList.And(x => x.DriverId == Param.DeliverKeyID);
            }
            //客户名称
            if (!string.IsNullOrEmpty(Param.CorporateClient))
            {
                SearchList = SearchList.And(x => x.CompanyName.Contains(Param.CorporateClient));
            }
            if (Param.TimeStart != null)
            {
                SearchList = SearchList.And(x => x.DeliverTime >= Param.TimeStart.Value.Date);
            }
            if (Param.TimeEnd != null)
            {
                SearchList = SearchList.And(x => x.DeliverTime < Param.TimeEnd.Value.Date.AddDays(1));
            }
            if (Param.WanjieStatus != null)
            {
                SearchList = SearchList.And(x => x.Wanjiestatus == Param.WanjieStatus);
            }
            //强制增加员工过滤
            RefAsync<int> totle = 0;
            var data = await _SugarClient.Queryable<OA_DeliverPlanPaiche>().Includes(x=>x.ZerenrenInfo).Includes(x=>x.Driver)
                .Where(SearchList).OrderByDescending(x => x.CreateTime.Value.Date).OrderBy(x => SqlFunc.Asc(x.Sort)).ToPageListAsync(Param.page.PageIndex, Param.page.PageSize, totle);
            Param.page.TotalCount = totle;
            return new DeliverOderPageRet
            {
                Data = data,
                page = Param.page,
            };
        }
        /// <summary>
        /// 获取用户反馈单详情
        /// </summary>
        /// <param name="KeyId"></param>
        /// <returns></returns>
        public async Task<OA_DeliverPlanPaiche> GetProblemPlanInfo(Guid KeyId)
        {
            if (!await CheckRols())
            {
                throw Oops.Oh("没有权限");
            }
            return await _SugarClient.Queryable<OA_DeliverPlanPaiche>().Includes(x=>x.ZerenrenInfo).Includes(x=>x.Driver)
                .Where(x => x.Keyid == KeyId &&  x.ShifouDelivery == 0).FirstAsync();
            //
        }
        /// <summary>
        /// 创建一个用户反馈详单
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        [LimitFilter(LimiType = Limttype.User, timespan = 5, ResponseMeg = "请勿在5内重复请求", InCount = 1)]
        public async Task<int> CreatProblemPlan(OA_DeliverPlanPaiche Param)
        {
            if (!await CheckRols())
            {
                throw Oops.Oh("没有权限");
            }
            OA_DeliverPlanPaiche DeliverPlan = new OA_DeliverPlanPaiche()
            {
                Keyid = Guid.NewGuid(),
                FirmId = _OAServices.firmId,
                BuyerId = Param.BuyerId ?? Guid.Empty,
                DeliverTime =DateTime.Now,
                DeliveredTime=DateTime.Now,
                CarId = 0,
                Wentifankui = Param.Wentifankui,
                Xingzhengzhuize = "",
                Yichangchuli = "",
                Zhuyishixiang = "",
                Gongzuokaoping = "",
                Transferstatus = 1,
                Sort =1 ,
                Creater = Param.Creater ?? Permissions.MemberId,
                CreateTime = DateTime.Now,
                DriverId = Param.DriverId,
                SellerOrderId = "",
                Dianhua = "",
                Dizhi = "",
                Remark = Param.Remark,
                BusinessManagerId =Permissions.KeyId,
                Biddingcompany =0,
                ShifouDelivery = 0,
                Lianxiren ="",
                Deliveredstatus = (int)DeliveredType.Undeliver,
                CompanyName = Param.CompanyName,
               Wanjiestatus= WanjieStatusType.UnFinish,
            };
            return await _SugarClient.Insertable(DeliverPlan).ExecuteCommandAsync();
        }
        /// <summary>
        /// 删除 问题反馈
        /// </summary>
        /// <param name="keyid"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<int > DeleteProblemPlan(Guid keyid)
        {
            if (!await CheckRols())
            {
                throw Oops.Oh("没有权限");
            }
          var a=await   _SugarClient.Queryable<OA_DeliverPlanPaiche>().Where(x => x.Keyid == keyid && x.ShifouDelivery == 0 && x.Wanjiestatus != WanjieStatusType.Finish&&x.BusinessManagerId==Permissions.KeyId).FirstAsync();
            if(a != null)
            {
             return   await _SugarClient.Deleteable(a).ExecuteCommandAsync();
            }
            throw Oops.Oh("没有权限或者问题已经处理完结");
        }
        /// <summary>
        /// 判断是否具有权限
        /// </summary>
@@ -600,7 +755,7 @@
        /// <summary>
        /// 员工姓名
        /// </summary>
        public string? StaffName { get; set; }
        public string StaffName { get; set; }
        /// <summary>
        /// 员工Id
        /// </summary>
cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs
@@ -262,8 +262,8 @@
            }
            OA_CarManage car = null;
            if (Param.DriverId != null)
                car = await _client.Queryable<OA_CarManage>().Where(x => x.StaffID == Param.DriverId && x.MemberID == _oAServices.firmId).FirstAsync();
            if (Param.CarId != null)
                car = await _client.Queryable<OA_CarManage>().Where(x => x.Keyid == Param.CarId && x.MemberID == _oAServices.firmId).Includes(x=>x.Staff).FirstAsync();
         
            OA_CorporateClients cor = null;
@@ -287,7 +287,7 @@
                Sort = Param.Sort,
                Creater = Param.Creater ?? Permissions.MemberId,
                CreateTime = DateTime.Now,
                DriverId = Param.DriverId,
                DriverId = car?.Staff?.Keyid??0,
                SellerOrderId = await CreatDeliverPlanSn(),
                Dianhua = Param.Dianhua,
                Dizhi = Param.Dizhi,
@@ -340,10 +340,14 @@
            Expression<Func<OA_DeliverPlanPaiche, bool>> SearchList = (x) => true;
            SearchList = SearchList.And(x => x.FirmId == _oAServices.firmId);
            //SearchList = SearchList.And(x => x.Creater == Permissions.MemberId);//只看自己
            SearchList = SearchList.And(x => x.ShifouDelivery != 2);//过滤有效
            SearchList = SearchList.And(x => x.ShifouDelivery != 2&&x.ShifouDelivery!=0);//过滤有效
            if (Param.DeliverKeyID != null)
            {
                SearchList = SearchList.And(x => x.DriverId == Param.DeliverKeyID);
            }
            if (Param.CarId != null)
            {
                SearchList = SearchList.And(x => x.CarId == Param.CarId);
            }
            //客户名称
            if (!string.IsNullOrEmpty(Param.CorporateClient))
@@ -372,8 +376,15 @@
            //强制增加员工过滤
            RefAsync<int> totle = 0;
            var data = await _client.Queryable<OA_DeliverPlanPaiche>().Includes(x => x.Driver).Includes(x => x.SentStaff).Includes(x=>x.DeliverPlans)
                .Where(SearchList).OrderBy(x => x.DeliverTime).OrderBy(x => x.Sort).ToPageListAsync(Param.page.PageIndex, Param.page.PageSize, totle);
            var data = await _client.Queryable<OA_DeliverPlanPaiche>().Includes(x => x.Car,car=>car.Staff).Includes(x => x.SentStaff).Includes(x=>x.DeliverPlans)
                .Where(SearchList).OrderBy(x => x.DeliverTime).OrderBy(x => x.Sort).Mapper(x =>
                {
                    if (x.Car?.Staff != null)
                    {
                        x.Car.CarNumber = x.Car.CarNumber + "(" + x.Car.Staff.Name + ")";
                        x.Car.Staff = null;
                    }
                }).ToPageListAsync(Param.page.PageIndex, Param.page.PageSize, totle);
            Param.page.TotalCount = totle;
            return new DeliverOderPageRet
@@ -405,11 +416,41 @@
            data.LastUpdateTime = DateTime.Now;
            data.Updater = Permissions.MemberId;
            if (data.DriverId != Param.DriverId)
            //以车辆选择为主 ,不在实现司机逻辑
            //if (data.DriverId != Param.DriverId)
            //{
            //    data.DriverId = Param.DriverId;
            //    var car = await _client.Queryable<OA_CarManage>().Where(x => x.StaffID == Param.DriverId && x.MemberID == _oAServices.firmId).FirstAsync();
            //    data.CarId = car == null ? 0 : car.Keyid;
            //    //foreach (var item in data.DeliverPlans)
            //    //{
            //    //    item.DriverId = Param.DriverId;
            //    //    item.CarId = car == null ? 0 : car.Keyid;
            //    //    item.Updater = Permissions.MemberId;
            //    //    item.LastUpdateTime = DateTime.Now;
            //    //    item.DeliverTime = Param.DeliverTime;
            //    //}
            //}
            if (data.CarId != Param.CarId)
            {
                data.DriverId = Param.DriverId;
                var car = await _client.Queryable<OA_CarManage>().Where(x => x.StaffID == Param.DriverId && x.MemberID == _oAServices.firmId).FirstAsync();
                data.CarId = car == null ? 0 : car.Keyid;
                var car = await _client.Queryable<OA_CarManage>().Where(x => x.Keyid == Param.CarId && x.MemberID == _oAServices.firmId).Includes(x=>x.Staff).FirstAsync();
                if(car == null)
                {
                    throw Oops.Oh("没有找到有效车辆信息");
                }
                data.CarId = Param.CarId;
                if (car.Staff != null)
                {
                    data.DriverId = car.Staff.Keyid;
                }
                else
                    data.DriverId = 0;
                //data.CarId = car == null ? 0 : car.Keyid;
                //foreach (var item in data.DeliverPlans)
                //{
@@ -422,7 +463,6 @@
                //}
            }
            data.DeliverTime = Param.DeliverTime;
            data.Remark = Param.Remark;
@@ -487,6 +527,7 @@
                            foreach (var item in data.DeliverPlans)
                            {
                                item.DriverId = 0;
                                item.CarId = 0;
                                item.DeliverPlanPaicheid = Guid.Empty;
                                item.Deliveredstatus = DeliveredType.Undeliver;                                
                                item.Updater = Permissions.MemberId;
@@ -558,8 +599,15 @@
            {
                throw Oops.Oh("没有权限");
            }
            return await _client.Queryable<OA_DeliverPlanPaiche>().Includes(x => x.Attachments).Includes(x => x.Driver).Includes(x => x.Manager).Includes(x=>x.DeliverPlans)
                .Where(x => x.Keyid == KeyId && x.ShifouDelivery != 2).FirstAsync();
            return await _client.Queryable<OA_DeliverPlanPaiche>().Includes(x => x.Attachments).Includes(x => x.Car, car => car.Staff).Includes(x => x.Manager).Includes(x=>x.DeliverPlans)
                .Where(x => x.Keyid == KeyId && x.ShifouDelivery != 2).Mapper(x=>
                {
                     if(x.Car?.Staff!=null)
                    {
                        x.Car.CarNumber = x.Car.CarNumber + "(" + x.Car.Staff.Name + ")";
                        x.Car.Staff = null;
                    }
                }).FirstAsync();
        }
@@ -745,7 +793,10 @@
        /// 司机KeyID
        /// </summary>
        public int? DeliverKeyID { get; set; }
        /// <summary>
        /// 车辆的keyid
        /// </summary>
        public int? CarId { get; set; }
        /// <summary>
        /// 客户名称
@@ -756,6 +807,11 @@
        /// 配送状态
        /// </summary>
        public DeliveredType? DeliveredState { get; set; }
        /// <summary>
        /// 问题反馈的是否完结状态
        /// </summary>
        public WanjieStatusType? WanjieStatus { get; set; }
        /// <summary>
        /// 页面参数
        /// </summary>
cylsg/cylsg.Model/ECTEModel/OA_CarManage.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using cylsg.Model.ECTEModel;
using SqlSugar;
namespace Models
{
@@ -87,8 +88,12 @@
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName="StaffID" ) ]
        public int? StaffID  { get; set;  }
        public int? StaffID  { get; set;  }
        /// <summary>
        /// 司机详情
        /// </summary>
        [Navigate( NavigateType.OneToOne,nameof(StaffID))]
        public  OaStaff? Staff { get; set; }
        /// <summary>
        /// 备  注:
        /// 默认值:
@@ -122,9 +127,12 @@
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName="InsuranceContent" ) ]
        public string? InsuranceContent  { get; set;  }
        public string? InsuranceContent  { get; set;  }
        /// <summary>
        /// 补填充字段,用于提示员工异常信息 不在库内部
        /// </summary>
        [SugarColumn(IsIgnore =true)]
        public string? Mark { get; set; }
    }
    
}
cylsg/cylsg.Model/ECTEModel/OA_DeliverPlanPaiche.cs
@@ -35,7 +35,7 @@
        public Guid? BuyerId { get; set; }
        /// <summary>
        /// 备  注:实际到达时间
        /// 备  注:实际到达时间 ,当作为问题反馈的时候,为提交反馈的时间
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "DeliveredTime")]
@@ -68,6 +68,11 @@
        ///</summary>
        [SugarColumn(ColumnName = "CarId")]
        public int? CarId { get; set; }
        /// <summary>
        /// 司机
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(CarId), nameof(OaStaff.Keyid))]
        public OA_CarManage? Car { get; set; }
        /// <summary>
        /// 备  注:司机id
@@ -205,7 +210,7 @@
        public int? Biddingcompany { get; set; }
        /// <summary>
        /// 备  注:  2忽略
        /// 备  注:  2忽略  是派车的是1,不派车填0(增加问题反馈)
        /// 默认值:
        ///</summary>
        [SugarColumn(ColumnName = "shifouDelivery")]
@@ -263,7 +268,7 @@
        /// 附件列表  3
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(OA_attachment.OA_Id), nameof(Keyid), "AttachmentType=3")]
        public List<OA_attachment> Attachments { get; set; }
        public List<OA_attachment> ?Attachments { get; set; }
        /// <summary>
@@ -271,8 +276,44 @@
        /// </summary>
        [SugarColumn(IsIgnore =true)]
        public int? DeliverTixingId { get; set; }
        /// <summary>
        /// 完结状态
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public WanjieStatusType? Wanjiestatus { get; set; }
        /// <summary>
        /// 责任人ID
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int?  Zerenren { get; set; }
        /// <summary>
        /// 责任人ID
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(Zerenren),nameof(OaStaff.Keyid))]
        public OaStaff? ZerenrenInfo { get; set; }
        /// <summary>
        /// 罚款
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public decimal? Fakuan { get; set; }
    }
    /// <summary>
    /// 完结状态
    /// </summary>
    public enum WanjieStatusType
    {
        /// <summary>
        /// 未完成
        /// </summary>
        UnFinish = 0,
        /// <summary>
        /// 已完成
        /// </summary>
        Finish = 1
    }
    
}