| | |
| | | OP80NewCode = OP80NewCode, |
| | | }; |
| | | } |
| | | |
| | | //判断是否已经出库 |
| | | List<WorkPieceOutbound> db_itemModelList = await _workPieceOutboundRep.DetachedEntities.Where(w => (w.WorkPieceID == OP80NewCode || w.OP80NewCode == OP80NewCode) && w.IsDeleted == false).ToListAsync(); |
| | | if (db_itemModelList != null && db_itemModelList.Count > 0) |
| | | { |
| | | var itemModel = db_itemModelList.First(); |
| | | var createitme = itemModel.CreatedTime == null ? "" : (((DateTimeOffset)itemModel.CreatedTime).UtcDateTime.ToString("yyyy-MM-dd HH:mm:ss")); |
| | | throw Oops.Oh($"工件{itemModel.WorkPieceID}已出库,出库时间:{createitme}"); |
| | | } |
| | | |
| | | return workPieceInfo; |
| | | } |
| | | |
| | |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost("outBoundWorkPiece")] |
| | | [UnitOfWork] |
| | | public async Task<string> outBoundWorkPiece([FromBody] OutBoundInput input) |
| | | { |
| | | |
| | |
| | | |
| | | var queryWorkPieceIDList = WorkPieceInfoLst.Select(x => x.WorkPieceID).ToList(); |
| | | List<WorkPieceOutbound> db_itemModelList = await _workPieceOutboundRep.Where(w => queryWorkPieceIDList.Contains(w.WorkPieceID) && w.IsDeleted == false).ToListAsync(); |
| | | |
| | | List<WorkPieceInfo> db_WorkPieceInfoList = await _workPieceInfoRep.Where(w => queryWorkPieceIDList.Contains(w.WorkPieceID) && w.IsDeleted == false).ToListAsync(); |
| | | |
| | | foreach (var item in WorkPieceInfoLst) |
| | | { |
| | |
| | | CreatedUserName = CurrentUserInfo.Name, |
| | | }; |
| | | addOutBoundList.Add(outBoundLog); |
| | | |
| | | var workPiece = db_WorkPieceInfoList.FirstOrDefault(w => w.WorkPieceID == item.WorkPieceID); |
| | | if (workPiece != null) |
| | | { |
| | | workPiece.OutPerson = CurrentUserInfo.Name; |
| | | workPiece.OutRemark = "撤销工件出库"; |
| | | workPiece.OutTime = DateTime.Now; |
| | | workPiece.IsOut = false; |
| | | |
| | | await _workPieceInfoRep.UpdateAsync(workPiece); |
| | | } |
| | | } |
| | | await _workPieceOutboundRep.InsertAsync(addOutBoundList); |
| | | return "出库成功"; |