| | |
| | | private readonly SqlSugarRepository<WmsRecordUpiProcess> _wmsRecordUpiProcessRep; |
| | | private readonly SqlSugarRepository<WmsRecordPackageProcess> _wmsRecordPackageProcessRep; |
| | | private readonly SqlSugarRepository<Mes_Upi_LineQueue> _mes_Upi_LineQueueRep; |
| | | private readonly SqlSugarRepository<WmsRecordUpiNg> _wmsRecordUpiNgRep; |
| | | |
| | | public WmsOperationTaskService( |
| | | SqlSugarRepository<Mes_Upi_LineQueue> mes_Upi_LineQueueRep, |
| | |
| | | , SqlSugarRepository<Mes_Order_Gather> mesOrderGatherRep |
| | | , SqlSugarRepository<WmsRecordUpiProcess> wmsRecordUpiProcessRep |
| | | , SqlSugarRepository<WmsRecordPackageProcess> wmsRecordPackageProcessRep |
| | | , SqlSugarRepository<WmsRecordUpiNg> wmsRecordUpiNgRep |
| | | ) |
| | | { |
| | | _wmsRecordUpiNgRep = wmsRecordUpiNgRep; |
| | | _sysConfigRep = sysConfigRep; |
| | | _mesPackageGatherRep = mesPackageGatherRep; |
| | | _rep = rep; |
| | |
| | | throw Oops.Oh($"没有找到包号{input.PackageCode}的汇总数据"); |
| | | } |
| | | |
| | | var _cretaorName = App.User.FindFirst(ClaimConst.RealName)?.Value; |
| | | |
| | | WmsRecordPackageProcess wmsRecordPackage = new WmsRecordPackageProcess(); |
| | | wmsRecordPackage = singlePackage.Adapt<WmsRecordPackageProcess>(); |
| | | wmsRecordPackage.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordPackage.CreateTime = DateTime.Now; |
| | | wmsRecordPackage.CreateUserName = _cretaorName; |
| | | wmsRecordPackage.Location = "BZ29"; |
| | | wmsRecordPackage.OperRemark = "核对标签"; |
| | | await _wmsRecordPackageProcessRep.InsertAsync(wmsRecordPackage); |
| | | |
| | | WmsRecordUpiProcess wmsRecordUpi = new WmsRecordUpiProcess(); |
| | | wmsRecordUpi = singleUpi.Adapt<WmsRecordUpiProcess>(); |
| | | wmsRecordUpi.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordUpi.CreateTime = DateTime.Now; |
| | | wmsRecordUpi.CreateUserName = _cretaorName; |
| | | wmsRecordUpi.Location = "BZ29"; |
| | | wmsRecordUpi.OperRemark = "核对标签"; |
| | | await _wmsRecordUpiProcessRep.InsertAsync(wmsRecordUpi); |
| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// NG包下线 |
| | | /// NG包下线-扫描包号 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | |
| | | { |
| | | throw Oops.Oh("包号不能为空"); |
| | | } |
| | | if (string.IsNullOrEmpty(input.Reason)) |
| | | { |
| | | throw Oops.Oh("原因不能为空"); |
| | | } |
| | | //if (string.IsNullOrEmpty(input.Reason)) |
| | | //{ |
| | | // throw Oops.Oh("原因不能为空"); |
| | | //} |
| | | |
| | | var singlePackage = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).FirstAsync(); |
| | | if (singlePackage == null) |
| | |
| | | { |
| | | throw Oops.Oh($"没有找到包号{input.PackageCode}的板件数据"); |
| | | } |
| | | var _cretaorName = App.User.FindFirst(ClaimConst.RealName)?.Value; |
| | | |
| | | foreach (var item in upiList) |
| | | { |
| | | item.UpiFlag = UpiFlagEnum.NG; |
| | |
| | | |
| | | WmsRecordUpiProcess wmsRecordUpi = new WmsRecordUpiProcess(); |
| | | wmsRecordUpi = item.Adapt<WmsRecordUpiProcess>(); |
| | | wmsRecordUpi.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordUpi.CreateTime = DateTime.Now; |
| | | wmsRecordUpi.CreateUserName = _cretaorName; |
| | | wmsRecordUpi.Location = ""; |
| | | wmsRecordUpi.OperRemark = "NG下线"; |
| | | await _wmsRecordUpiProcessRep.InsertAsync(wmsRecordUpi); |
| | | |
| | | WmsRecordUpiNg wmsRecordUpiNg = new WmsRecordUpiNg(); |
| | | wmsRecordUpiNg = item.Adapt<WmsRecordUpiNg>(); |
| | | wmsRecordUpiNg.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordUpiNg.CreateTime = DateTime.Now; |
| | | wmsRecordUpiNg.CreateUserName = _cretaorName; |
| | | wmsRecordUpiNg.OperRemark = "NG下线"; |
| | | await _wmsRecordUpiNgRep.InsertAsync(wmsRecordUpiNg); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | WmsRecordPackageProcess wmsRecordPackage = new WmsRecordPackageProcess(); |
| | | wmsRecordPackage = singlePackage.Adapt<WmsRecordPackageProcess>(); |
| | | wmsRecordPackage.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordPackage.Location = ""; |
| | | wmsRecordPackage.OperRemark = "NG下线"; |
| | | wmsRecordPackage.CreateTime = DateTime.Now; |
| | | wmsRecordPackage.CreateUserName = _cretaorName; |
| | | await _wmsRecordPackageProcessRep.InsertAsync(wmsRecordPackage); |
| | | |
| | | |
| | | await _mesPackageGatherRep.UpdateAsync(singlePackage); |
| | | await _mesBatchOrderUpiRep.UpdateRangeAsync(upiList); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 标记NG-扫描件号 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ApiDescriptionSettings(Name = "SetNG")] |
| | | [Description("WmsOperationTask/SetNG")] |
| | | [UnitOfWork] |
| | | public async Task SetNG(SetNGInput input) |
| | | { |
| | | if (input == null) |
| | | { |
| | | throw Oops.Oh("参数不能为空"); |
| | | } |
| | | if (string.IsNullOrEmpty(input.Upi)) |
| | | { |
| | | throw Oops.Oh("部件条码不能为空"); |
| | | } |
| | | //if (string.IsNullOrEmpty(input.Reason)) |
| | | //{ |
| | | // throw Oops.Oh("原因不能为空"); |
| | | //} |
| | | |
| | | var singleUpi = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.UPI == input.Upi).FirstAsync(); |
| | | if (singleUpi == null) |
| | | { |
| | | throw Oops.Oh($"没有找到部件条码{input.Upi}的数据"); |
| | | } |
| | | var packageCode = singleUpi.PackageCode; |
| | | var singlePackage = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == packageCode).FirstAsync(); |
| | | if (singlePackage == null) |
| | | { |
| | | throw Oops.Oh($"没有找到包号{packageCode}的汇总数据"); |
| | | } |
| | | |
| | | var _cretaorName = App.User.FindFirst(ClaimConst.RealName)?.Value; |
| | | |
| | | singlePackage.UpiFlag = UpiFlagEnum.NG; |
| | | singlePackage.UpdateTime = DateTime.Now; |
| | | singlePackage.UpdateUserName = _cretaorName; |
| | | |
| | | var upiList = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.PackageCode == packageCode).ToListAsync(); |
| | | if (upiList == null) |
| | | { |
| | | throw Oops.Oh($"没有找到包号{packageCode}的板件数据"); |
| | | } |
| | | foreach (var item in upiList) |
| | | { |
| | | item.UpiFlag = UpiFlagEnum.NG; |
| | | item.UpdateTime = DateTime.Now; |
| | | item.UpdateUserName = _cretaorName; |
| | | |
| | | WmsRecordUpiProcess wmsRecordUpi = new WmsRecordUpiProcess(); |
| | | wmsRecordUpi = item.Adapt<WmsRecordUpiProcess>(); |
| | | wmsRecordUpi.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordUpi.CreateTime = DateTime.Now; |
| | | wmsRecordUpi.CreateUserName = _cretaorName; |
| | | wmsRecordUpi.Location = ""; |
| | | wmsRecordUpi.OperRemark = "标记NG"; |
| | | await _wmsRecordUpiProcessRep.InsertAsync(wmsRecordUpi); |
| | | |
| | | WmsRecordUpiNg wmsRecordUpiNg = new WmsRecordUpiNg(); |
| | | wmsRecordUpiNg = item.Adapt<WmsRecordUpiNg>(); |
| | | wmsRecordUpiNg.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordUpiNg.CreateTime = DateTime.Now; |
| | | wmsRecordUpiNg.CreateUserName = _cretaorName; |
| | | wmsRecordUpiNg.OperRemark = "标记NG"; |
| | | await _wmsRecordUpiNgRep.InsertAsync(wmsRecordUpiNg); |
| | | } |
| | | |
| | | |
| | | WmsRecordPackageProcess wmsRecordPackage = new WmsRecordPackageProcess(); |
| | | wmsRecordPackage = singlePackage.Adapt<WmsRecordPackageProcess>(); |
| | | wmsRecordPackage.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordPackage.Location = ""; |
| | | wmsRecordPackage.OperRemark = "标记NG"; |
| | | wmsRecordPackage.CreateTime = DateTime.Now; |
| | | wmsRecordPackage.CreateUserName = _cretaorName; |
| | | await _wmsRecordPackageProcessRep.InsertAsync(wmsRecordPackage); |
| | | |
| | | |
| | | await _mesPackageGatherRep.UpdateAsync(singlePackage); |
| | | await _mesBatchOrderUpiRep.UpdateRangeAsync(upiList); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 取消NG-扫描件号 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ApiDescriptionSettings(Name = "CancelNG")] |
| | | [Description("WmsOperationTask/CancelNG")] |
| | | [UnitOfWork] |
| | | public async Task CancelNG(CancelNGInput input) |
| | | { |
| | | if (input == null) |
| | | { |
| | | throw Oops.Oh("参数不能为空"); |
| | | } |
| | | if (string.IsNullOrEmpty(input.Upi)) |
| | | { |
| | | throw Oops.Oh("部件条码不能为空"); |
| | | } |
| | | //if (string.IsNullOrEmpty(input.Reason)) |
| | | //{ |
| | | // throw Oops.Oh("原因不能为空"); |
| | | //} |
| | | |
| | | var singleUpi = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.UPI == input.Upi).FirstAsync(); |
| | | if (singleUpi == null) |
| | | { |
| | | throw Oops.Oh($"没有找到部件条码{input.Upi}的数据"); |
| | | } |
| | | var packageCode = singleUpi.PackageCode; |
| | | var singlePackage = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == packageCode).FirstAsync(); |
| | | if (singlePackage == null) |
| | | { |
| | | throw Oops.Oh($"没有找到包号{packageCode}的汇总数据"); |
| | | } |
| | | |
| | | var _cretaorName = App.User.FindFirst(ClaimConst.RealName)?.Value; |
| | | |
| | | singlePackage.UpiFlag = UpiFlagEnum.正常; |
| | | singlePackage.UpdateTime = DateTime.Now; |
| | | singlePackage.UpdateUserName = _cretaorName; |
| | | |
| | | var upiList = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.PackageCode == packageCode).ToListAsync(); |
| | | if (upiList == null) |
| | | { |
| | | throw Oops.Oh($"没有找到包号{packageCode}的板件数据"); |
| | | } |
| | | foreach (var item in upiList) |
| | | { |
| | | item.UpiFlag = UpiFlagEnum.正常; |
| | | item.UpdateTime = DateTime.Now; |
| | | item.UpdateUserName = _cretaorName; |
| | | |
| | | WmsRecordUpiProcess wmsRecordUpi = new WmsRecordUpiProcess(); |
| | | wmsRecordUpi = item.Adapt<WmsRecordUpiProcess>(); |
| | | wmsRecordUpi.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordUpi.CreateTime = DateTime.Now; |
| | | wmsRecordUpi.CreateUserName = _cretaorName; |
| | | wmsRecordUpi.Location = ""; |
| | | wmsRecordUpi.OperRemark = "取消NG"; |
| | | await _wmsRecordUpiProcessRep.InsertAsync(wmsRecordUpi); |
| | | |
| | | WmsRecordUpiNg wmsRecordUpiNg = new WmsRecordUpiNg(); |
| | | wmsRecordUpiNg = item.Adapt<WmsRecordUpiNg>(); |
| | | wmsRecordUpiNg.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordUpiNg.CreateTime = DateTime.Now; |
| | | wmsRecordUpiNg.CreateUserName = _cretaorName; |
| | | wmsRecordUpiNg.OperRemark = "取消NG"; |
| | | await _wmsRecordUpiNgRep.InsertAsync(wmsRecordUpiNg); |
| | | } |
| | | |
| | | |
| | | WmsRecordPackageProcess wmsRecordPackage = new WmsRecordPackageProcess(); |
| | | wmsRecordPackage = singlePackage.Adapt<WmsRecordPackageProcess>(); |
| | | wmsRecordPackage.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsRecordPackage.Location = ""; |
| | | wmsRecordPackage.OperRemark = "取消NG"; |
| | | wmsRecordPackage.CreateTime = DateTime.Now; |
| | | wmsRecordPackage.CreateUserName = _cretaorName; |
| | | await _wmsRecordPackageProcessRep.InsertAsync(wmsRecordPackage); |
| | | |
| | | |