| | |
| | | [DisableOpLog] |
| | | public class WorkPieceOutboundService : IWorkPieceOutboundService, IDynamicApiController, ITransient |
| | | { |
| | | private readonly IRepository<WorkPieceOutbound,MasterDbContextLocator> _workPieceOutboundRep; |
| | | |
| | | private readonly IRepository<WorkPieceOutbound, MasterDbContextLocator> _workPieceOutboundRep; |
| | | private readonly IRepository<WorkPieceInfo, MasterDbContextLocator> _workPieceInfoRep; |
| | | |
| | | public WorkPieceOutboundService( |
| | | IRepository<WorkPieceOutbound,MasterDbContextLocator> workPieceOutboundRep |
| | | IRepository<WorkPieceInfo, MasterDbContextLocator> workPieceInfoRep, |
| | | IRepository<WorkPieceOutbound, MasterDbContextLocator> workPieceOutboundRep |
| | | ) |
| | | { |
| | | _workPieceInfoRep = workPieceInfoRep; |
| | | _workPieceOutboundRep = workPieceOutboundRep; |
| | | } |
| | | |
| | |
| | | var workPieceOutbounds = await _workPieceOutboundRep.DetachedEntities |
| | | .Where(!string.IsNullOrEmpty(input.WorkPieceID), u => u.WorkPieceID.Contains(input.WorkPieceID)) |
| | | .Where(!string.IsNullOrEmpty(input.OP80NewCode), u => u.OP80NewCode.Contains(input.OP80NewCode)) |
| | | .Where(!string.IsNullOrEmpty(input.WorkPieceOutboundUserName), u => u.WorkPieceOutboundUserName.Contains(input.WorkPieceOutboundUserName)) |
| | | .Where(!string.IsNullOrEmpty(input.StartTimeBeginTime.ToString()), u => u.WorkPieceOutboundTime >= input.StartTimeBeginTime) |
| | | .Where(!string.IsNullOrEmpty(input.StartTimeEndTime.ToString()), u => u.WorkPieceOutboundTime <= input.StartTimeEndTime) |
| | | .OrderBy(PageInputOrder.OrderBuilder<WorkPieceOutboundSearch>(input)) |
| | |
| | | if (!isExist) throw Oops.Oh(ErrorCode.D3000); |
| | | |
| | | var workPieceOutbound = input.Adapt<WorkPieceOutbound>(); |
| | | await _workPieceOutboundRep.UpdateAsync(workPieceOutbound,ignoreNullValues:true); |
| | | await _workPieceOutboundRep.UpdateAsync(workPieceOutbound, ignoreNullValues: true); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost("revoke")] |
| | | [UnitOfWork] |
| | | public async Task Revoke(List<DeleteWorkPieceOutboundInput> input) |
| | | { |
| | | foreach (var item in input) { |
| | | foreach (var item in input) |
| | | { |
| | | var workPieceOutbound = await _workPieceOutboundRep.FirstOrDefaultAsync(u => u.Id == item.Id); |
| | | if (workPieceOutbound == null) |
| | | { |
| | | throw Oops.Oh("工件出库信息不存在"); |
| | | } |
| | | workPieceOutbound.IsDeleted = true; |
| | | workPieceOutbound.Remark = workPieceOutbound.Remark??""+"撤销发货"; |
| | | workPieceOutbound.Remark = workPieceOutbound.Remark ?? "" + "撤销发货"; |
| | | await _workPieceOutboundRep.UpdateAsync(workPieceOutbound); |
| | | |
| | | var workPiece = await _workPieceInfoRep.FirstOrDefaultAsync(u => u.WorkPieceID == workPieceOutbound.WorkPieceID); |
| | | if (workPiece != null) |
| | | { |
| | | workPiece.OutPerson = CurrentUserInfo.Name; |
| | | workPiece.OutRemark = "撤销工件出库"; |
| | | workPiece.OutTime = DateTime.Now; |
| | | workPiece.IsOut = false; |
| | | |
| | | await _workPieceInfoRep.UpdateAsync(workPiece); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |