| | |
| | | private readonly SqlSugarRepository<Mes_Order_Gather> _mesOrderGatherRep; |
| | | private readonly SqlSugarRepository<Mes_Package_UnLine_Record> _mesPackage_UnLine_RecordRep; |
| | | private readonly SqlSugarRepository<Mes_Package_LineQueue> _mesPackage_LineQueueRep; |
| | | private readonly SqlSugarRepository<WmsRecordUpiReplenish> _wmsRecordUpiReplenishRep; |
| | | private readonly SqlSugarRepository<WmsRecordUpiProcess> _wmsRecordUpiProcessRep; |
| | | |
| | | public WmsCommonnQueryService(SqlSugarRepository<WmsRbLineTask> wmsRbLineTaskRep, SqlSugarRepository<WmsStockQuan> wmsStockQuanRep |
| | | , SqlSugarRepository<Mes_Package_Gather> mesPackageGatherRep |
| | |
| | | , SqlSugarRepository<Mes_Order_Gather> mesOrderGatherRep |
| | | , SqlSugarRepository<Mes_Package_UnLine_Record> mesPackage_UnLine_RecordRep |
| | | , SqlSugarRepository<Mes_Package_LineQueue> mesPackage_LineQueueRep |
| | | , SqlSugarRepository<WmsRecordUpiReplenish> wmsRecordUpiReplenishRep |
| | | , SqlSugarRepository<WmsRecordUpiProcess> wmsRecordUpiProcessRep |
| | | ) |
| | | { |
| | | _wmsRecordUpiReplenishRep = wmsRecordUpiReplenishRep; |
| | | _sysConfigRep = sysConfigRep; |
| | | _mesPackageGatherRep = mesPackageGatherRep; |
| | | _wmsRbLineTaskRep = wmsRbLineTaskRep; |
| | |
| | | _mesOrderGatherRep = mesOrderGatherRep; |
| | | _mesPackage_UnLine_RecordRep = mesPackage_UnLine_RecordRep; |
| | | _mesPackage_LineQueueRep = mesPackage_LineQueueRep; |
| | | _wmsRecordUpiProcessRep = wmsRecordUpiProcessRep; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | resJson = listRes.FirstOrDefault(u => u.UPI == input.UPI); |
| | | //var filteredResult = listRes.FirstOrDefault(u => u.UPI == input.UPI); |
| | | } |
| | | var _cretaorName = App.User.FindFirst(ClaimConst.RealName)?.Value; |
| | | if (resJson != null) |
| | | { |
| | | //执行人工补板动作 |
| | |
| | | { |
| | | throw Oops.Oh("补板工位允许进板请求失败:" + res.resMsg); |
| | | } |
| | | //*/ |
| | | |
| | | //记录补板记录和板件履历 |
| | | var singleUpi = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.UPI == input.UPI).FirstAsync(); |
| | | if (singleUpi == null) |
| | | { |
| | | throw Oops.Oh($"没有找到部件条码{input.UPI}的数据"); |
| | | } |
| | | WmsRecordUpiProcess wmsRecordUpi = new WmsRecordUpiProcess(); |
| | | wmsRecordUpi = singleUpi.Adapt<WmsRecordUpiProcess>(); |
| | | wmsRecordUpi.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordUpi.CreateTime = DateTime.Now; |
| | | wmsRecordUpi.CreateUserName = _cretaorName; |
| | | wmsRecordUpi.Location = ""; |
| | | wmsRecordUpi.OperRemark = "人工补板"; |
| | | await _wmsRecordUpiProcessRep.InsertAsync(wmsRecordUpi); |
| | | |
| | | WmsRecordUpiReplenish wmsRecordUpiNg = new WmsRecordUpiReplenish(); |
| | | wmsRecordUpiNg = singleUpi.Adapt<WmsRecordUpiReplenish>(); |
| | | wmsRecordUpiNg.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordUpiNg.CreateTime = DateTime.Now; |
| | | wmsRecordUpiNg.CreateUserName = _cretaorName; |
| | | wmsRecordUpiNg.OperRemark = "人工补板"; |
| | | await _wmsRecordUpiReplenishRep.InsertAsync(wmsRecordUpiNg); |
| | | } |
| | | else |
| | | { |
| | |
| | | return groupedResult; // 返回分组结果 |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 查询包数据 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ApiDescriptionSettings(Name = "QueryPackage")] |
| | | [Description("WmsCommonnQuery/QueryPackage")] |
| | | public async Task<Mes_Package_Gather> QueryPackage(QueryPackageInput input) |
| | | { |
| | | if (input == null || input.PackageCode == null) |
| | | { |
| | | throw Oops.Oh("参数不能为空"); |
| | | } |
| | | |
| | | var package = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).FirstAsync(); |
| | | if (package == null) |
| | | { |
| | | throw Oops.Oh($"没有找到包号{input.PackageCode}的汇总数据"); |
| | | } |
| | | return package; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 根据包号,查询某个包下的板件数据 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ApiDescriptionSettings(Name = "QueryUpiListByPackage")] |
| | | [Description("WmsCommonnQuery/QueryUpiListByPackage")] |
| | | public async Task<List<Mes_BatchOrderUPI_New>> QueryUpiListByPackage(QueryPackageInput input) |
| | | { |
| | | if (input == null || input.PackageCode == null) |
| | | { |
| | | throw Oops.Oh("参数不能为空"); |
| | | } |
| | | |
| | | var package = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).FirstAsync(); |
| | | if (package == null) |
| | | { |
| | | throw Oops.Oh($"没有找到包号{input.PackageCode}的汇总数据"); |
| | | } |
| | | |
| | | var upiList = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).ToListAsync(); |
| | | |
| | | return upiList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据某个Upi,查询某个包下的板件数据 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ApiDescriptionSettings(Name = "QueryUpiListByUpi")] |
| | | [Description("WmsCommonnQuery/QueryUpiListByUpi")] |
| | | public async Task<List<Mes_BatchOrderUPI_New>> QueryUpiListByUpi(QueryUpiListByUpiInput input) |
| | | { |
| | | if (input == null || input.Upi == null) |
| | | { |
| | | throw Oops.Oh("参数不能为空"); |
| | | } |
| | | |
| | | var singleUpi = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.UPI == input.Upi).FirstAsync(); |
| | | if (singleUpi == null) |
| | | { |
| | | throw Oops.Oh($"没有找到部件条码{input.Upi}的数据"); |
| | | } |
| | | |
| | | var package = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == singleUpi.PackageCode).FirstAsync(); |
| | | if (package == null) |
| | | { |
| | | throw Oops.Oh($"没有找到包号{singleUpi.PackageCode}的汇总数据"); |
| | | } |
| | | |
| | | var upiList = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.PackageCode == singleUpi.PackageCode).ToListAsync(); |
| | | |
| | | return upiList; |
| | | } |
| | | |
| | | } |
| | | |