From 757e9a10418043eb1a5c5e41975d3eb39db66a80 Mon Sep 17 00:00:00 2001 From: 移动系统liao <liaoxujun@qq.com> Date: 星期五, 20 六月 2025 14:27:04 +0800 Subject: [PATCH] no message --- cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs | 84 +++++++++++++++++++++++++++++++++++------- 1 files changed, 70 insertions(+), 14 deletions(-) diff --git a/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs b/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs index deda07e..ecaad95 100644 --- a/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs +++ b/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> + /// 杞﹁締鐨刱eyid + /// </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> -- Gitblit v1.9.1