From bbd4b2fdae6667540a0ec71ad5bfabc643ac1b6c Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 03 7月 2024 09:07:48 +0800 Subject: [PATCH] 2 --- iWara.SCADA.Code/iWare.Wms.Application/Service/Pda/PdaService.cs | 35 ++++++++++++++++++++++++++++++++++- 1 files changed, 34 insertions(+), 1 deletions(-) diff --git a/iWara.SCADA.Code/iWare.Wms.Application/Service/Pda/PdaService.cs b/iWara.SCADA.Code/iWare.Wms.Application/Service/Pda/PdaService.cs index 655cbdd..a9919ec 100644 --- a/iWara.SCADA.Code/iWare.Wms.Application/Service/Pda/PdaService.cs +++ b/iWara.SCADA.Code/iWare.Wms.Application/Service/Pda/PdaService.cs @@ -18,6 +18,7 @@ //[Route("api")] [ApiDescriptionSettings("Pda鐩稿叧鎺ュ彛", Name = "PdaService", Order = 100)] [Route("api/[Controller]")] + [DisableOpLog] public class PdaService : IDynamicApiController, ITransient { private readonly IRepository<EquipmentBaseInfo, MasterDbContextLocator> _equipmentBaseInfoRep; @@ -221,6 +222,7 @@ /// <param name="input"></param> /// <returns></returns> [HttpGet("getWorkPieceProcess")] + [DisableOpLog] public async Task<WorkPieceProcessPdaOutput> getWorkPieceProcess([FromQuery] WorkPieceProcessPdaSearch input) { var workPieceProcesss = await _workPieceProcessRep.DetachedEntities @@ -411,12 +413,17 @@ /// </summary> /// <returns></returns> [HttpGet("getWorkPieceByOP80NewCode")] + [DisableOpLog] public async Task<WorkPieceInfoOutput> getWorkPieceByOP80NewCode([FromQuery] WorkPieceByOP80NewCodeInputSearch input) { if (string.IsNullOrEmpty(input.OP80NewCode)) { - throw Oops.Oh($"璇疯緭鍏P80鎵撳嵃鎴愬搧鐮佹垨浜岀淮鐮侊紒"); + throw Oops.Oh($"璇疯緭鍏ユ垚鍝佺爜鎴栧伐浠剁爜锛�"); + } + if (input.OP80NewCode.Length > 22) + { + throw Oops.Oh($"宸ヤ欢鐮佹垨鎴愬搧鐮亄input.OP80NewCode}闀垮害涓嶆纭紒"); } string OP80NewCode = input.OP80NewCode.Trim(); var workPieceInfo = await _workPieceInfoRep.DetachedEntities @@ -447,6 +454,16 @@ 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; } @@ -456,6 +473,8 @@ /// <param name="input"></param> /// <returns></returns> [HttpPost("outBoundWorkPiece")] + [DisableOpLog] + [UnitOfWork] public async Task<string> outBoundWorkPiece([FromBody] OutBoundInput input) { @@ -474,6 +493,8 @@ 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) { @@ -497,6 +518,17 @@ 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 "鍑哄簱鎴愬姛"; @@ -508,6 +540,7 @@ /// <param name="input"></param> /// <returns></returns> [HttpPost("getOutBoundWorkPieceInfoCount")] + [DisableOpLog] public async Task<string> GetOutBoundWorkPieceInfoCount() { DateTimeOffset now = DateTimeOffset.Now; // 鑾峰彇褰撳墠鏃堕棿锛屽寘鎷椂鍖哄亸绉婚噺 -- Gitblit v1.9.3