| | |
| | | |
| | | } |
| | | 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; |
| | |
| | | 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, |
| | |
| | | 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)) |
| | |
| | | |
| | | //强制增加员工过滤 |
| | | 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 |
| | |
| | | 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) |
| | | //{ |
| | |
| | | //} |
| | | } |
| | | |
| | | |
| | | data.DeliverTime = Param.DeliverTime; |
| | | data.Remark = Param.Remark; |
| | | |
| | |
| | | foreach (var item in data.DeliverPlans) |
| | | { |
| | | item.DriverId = 0; |
| | | item.CarId = 0; |
| | | item.DeliverPlanPaicheid = Guid.Empty; |
| | | item.Deliveredstatus = DeliveredType.Undeliver; |
| | | item.Updater = Permissions.MemberId; |
| | |
| | | { |
| | | 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(); |
| | | |
| | | } |
| | | |
| | |
| | | /// 司机KeyID |
| | | /// </summary> |
| | | public int? DeliverKeyID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 车辆的keyid |
| | | /// </summary> |
| | | public int? CarId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 客户名称 |
| | |
| | | /// 配送状态 |
| | | /// </summary> |
| | | public DeliveredType? DeliveredState { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 问题反馈的是否完结状态 |
| | | /// </summary> |
| | | public WanjieStatusType? WanjieStatus { get; set; } |
| | | /// <summary> |
| | | /// 页面参数 |
| | | /// </summary> |