| | |
| | | packageObj.UpiStatus = UpiStatusEnum.已下线; |
| | | await _mesPackageGatherRep.UpdateAsync(packageObj); |
| | | |
| | | |
| | | //下线更新 订单表数据 _mesOrderGatherRep |
| | | await UpdateOrderGather(packageObj); |
| | | |
| | | foreach (var quan in quanList) |
| | | { |
| | | //清理 队列表 |
| | |
| | | throw Oops.Oh($"没有找到包号{input.PackageCode}的汇总数据"); |
| | | } |
| | | |
| | | if (singlePackage.UpiStatus == UpiStatusEnum.已下线) |
| | | { |
| | | throw Oops.Oh($"包号{input.PackageCode}已经下线"); |
| | | } |
| | | |
| | | singlePackage.UpiFlag = UpiFlagEnum.NG; |
| | | singlePackage.UpdateTime = DateTime.Now; |
| | | singlePackage.UpiStatus = UpiStatusEnum.已下线; |
| | |
| | | |
| | | } |
| | | |
| | | //下线更新 订单表数据 _mesOrderGatherRep |
| | | await UpdateOrderGather(singlePackage); |
| | | |
| | | |
| | | WmsRecordPackageProcess wmsRecordPackage = new WmsRecordPackageProcess(); |
| | | wmsRecordPackage = singlePackage.Adapt<WmsRecordPackageProcess>(); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下线更新 订单表数据 |
| | | /// </summary> |
| | | /// <param name="singlePackage"></param> |
| | | /// <returns></returns> |
| | | private async Task UpdateOrderGather(Mes_Package_Gather singlePackage) |
| | | { |
| | | //下线更新 订单表数据 _mesOrderGatherRep |
| | | bool isAdd = false; |
| | | var order = await _mesOrderGatherRep.AsQueryable().Where(x => x.Info5 == singlePackage.Info5).FirstAsync(); |
| | | if (order == null) |
| | | { |
| | | isAdd = true; |
| | | order = new Mes_Order_Gather() |
| | | { |
| | | Info5 = singlePackage.Info5, |
| | | OrderId = singlePackage.OrderId, |
| | | PlanNo = singlePackage.PlanNo, |
| | | }; |
| | | } |
| | | var packageList = await _mesPackageGatherRep.AsQueryable().Where(x => x.Info5 == singlePackage.Info5).ToListAsync(); |
| | | order.PackageNum = packageList.Count(); |
| | | order.UnLinePackageNum = packageList.Where(x => x.UpiStatus == UpiStatusEnum.已下线).Count() + 1; |
| | | order.NgPackageNum = packageList.Where(x => x.UpiStatus == UpiStatusEnum.已下线 && x.UpiFlag == UpiFlagEnum.NG).Count() + 1; |
| | | order.NoUnLinePackageNum = order.PackageNum - order.UnLinePackageNum; |
| | | |
| | | order.AllPackageArea = packageList.Sum(x => Convert.ToDecimal(x.Info13)); |
| | | order.ScanPackageArea = packageList.Where(x => x.UpiStatus == UpiStatusEnum.已下线 && x.UpiFlag == (int)UpiFlagEnum.正常).Sum(x => Convert.ToDecimal(x.Info13)); |
| | | order.NoScanPackageArea = order.AllPackageArea - order.ScanPackageArea; |
| | | if (isAdd) |
| | | { |
| | | await _mesOrderGatherRep.InsertAsync(order); |
| | | } |
| | | else |
| | | { |
| | | await _mesOrderGatherRep.UpdateAsync(order); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 标记NG-扫描件号 |
| | | /// </summary> |
| | | /// <param name="input"></param> |