| | |
| | | using Furion.DynamicApiController; |
| | | using System.Text; |
| | | using iWare.Wms.Core.Enum; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | |
| | | namespace iWare.Wms.Application.Service.Pda |
| | | { |
| | |
| | | //[Route("api")] |
| | | [ApiDescriptionSettings("Pda相关接口", Name = "PdaService", Order = 100)] |
| | | [Route("api/[Controller]")] |
| | | [DisableOpLog] |
| | | public class PdaService : IDynamicApiController, ITransient |
| | | { |
| | | private readonly IRepository<EquipmentBaseInfo, MasterDbContextLocator> _equipmentBaseInfoRep; |
| | |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpGet("getWorkPieceProcess")] |
| | | [DisableOpLog] |
| | | public async Task<WorkPieceProcessPdaOutput> getWorkPieceProcess([FromQuery] WorkPieceProcessPdaSearch input) |
| | | { |
| | | var workPieceProcesss = await _workPieceProcessRep.DetachedEntities |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet("getWorkPieceByOP80NewCode")] |
| | | [DisableOpLog] |
| | | [AllowAnonymous] |
| | | public async Task<WorkPieceInfoOutput> getWorkPieceByOP80NewCode([FromQuery] WorkPieceByOP80NewCodeInputSearch input) |
| | | { |
| | | |
| | | if (string.IsNullOrEmpty(input.OP80NewCode)) |
| | | { |
| | | throw Oops.Oh($"请输入OP80打印成品码或二维码!"); |
| | | throw Oops.Oh($"请输入成品码或工件码!"); |
| | | } |
| | | if (input.OP80NewCode.Length > 22) |
| | | { |
| | | throw Oops.Oh($"工件码或成品码{input.OP80NewCode}长度不正确!"); |
| | | } |
| | | string OP80NewCode = input.OP80NewCode.Trim(); |
| | | var workPieceInfo = await _workPieceInfoRep.DetachedEntities |
| | |
| | | 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")] |
| | | [DisableOpLog] |
| | | [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 "出库成功"; |
| | |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost("getOutBoundWorkPieceInfoCount")] |
| | | [DisableOpLog] |
| | | public async Task<string> GetOutBoundWorkPieceInfoCount() |
| | | { |
| | | DateTimeOffset now = DateTimeOffset.Now; // 获取当前时间,包括时区偏移量 |