| | |
| | | public async Task<int > StartDeliverPlan(Guid KeyId) |
| | | { |
| | | |
| | | |
| | | if (!await CheckRols()) |
| | | { |
| | | throw Oops.Oh("没有权限"); |
| | | } |
| | | var a= await _client.Queryable<OA_DeliverPlanPaiche>().Where(x => x.DriverId == Permissions.KeyId && x.Keyid == KeyId && x.ShifouDelivery != 2).FirstAsync(); |
| | | DateTime specificDateTime = new DateTime(2025, 4, 9, 23, 59, 59);//2025年4月10 日之后的,必须一单一单点击完成后才能送货 |
| | | var count = await _client.Queryable<OA_DeliverPlanPaiche>().Where(x => x.DriverId == Permissions.KeyId && x.Keyid != KeyId && x.ShifouDelivery != 2 && x.Deliveredstatus == DeliveredType.Deliver&&x.DeliverTime> specificDateTime).CountAsync(); |
| | | if(count > 0) |
| | | { |
| | | throw Oops.Oh($"你还有{count}送货任务没有确认完成,不能开始新的任务"); |
| | | } |
| | | |
| | | var a= await _client.Queryable<OA_DeliverPlanPaiche>().Where(x => x.DriverId == Permissions.KeyId && x.Keyid == KeyId && x.ShifouDelivery != 2).FirstAsync(); |
| | | if(a==null) |
| | | throw Oops.Oh("没有权限"); |
| | | if(a.Deliveredstatus!= DeliveredType.Undeliver) |
| | |
| | | a.Deliveredstatus= Param.Deliveredstatus; |
| | | a.Attachments = Param.Attachments; |
| | | |
| | | return await _client.UpdateNav(a).Include(x=>x.Attachments,new SqlSugar.UpdateNavOptions() |
| | | { |
| | | OneToManyInsertOrUpdate = true,//配置启用 插入、更新或删除模式 |
| | | }).Include(x=>x.DeliverPlans,new UpdateNavOptions() |
| | | { |
| | | OneToManyInsertOrUpdate=true, |
| | | } |
| | | ).ExecuteCommandAsync(); |
| | | return await _client.UpdateNav(a).Include(x=>x.Attachments).ExecuteCommandAsync(); |
| | | |
| | | //await _client.AsTenant().BeginTranAsync(); |
| | | //try |
| | | //{ |
| | | // var id = await _client.Insertable(pram).ExecuteReturnIdentityAsync(); |
| | | // if (pram.WorkPlanAttachments?.Count > 0) |
| | | // { |
| | | // foreach (var item in pram.WorkPlanAttachments) |
| | | // { |
| | | // item.OA_WorkPlanId = id; |
| | | |
| | | // } |
| | | // await _client.Insertable(pram.WorkPlanAttachments).ExecuteCommandAsync(); |
| | | // } |
| | | // await _client.AsTenant().CommitTranAsync(); |
| | | //} |
| | | //catch (Exception) |
| | | //{ |
| | | // await _client.AsTenant().RollbackTranAsync(); |
| | | // throw; |
| | | //} |
| | | |
| | | //await _client.AsTenant().BeginTranAsync(); |
| | | //try |
| | |
| | | //{ |
| | | // OneToManyInsertOrUpdate = true, |
| | | //}) |
| | | .Include(x => x.CarConditionAttachments,new UpdateNavOptions |
| | | { |
| | | OneToManyInsertOrUpdate = true, |
| | | }).ExecuteCommandAsync(); |
| | | .Include(x => x.CarConditionAttachments).ExecuteCommandAsync(); |
| | | } |
| | | |
| | | |