From 293d84d5c3881e9d39db524a9dd66bed78864fef Mon Sep 17 00:00:00 2001 From: qian Date: Wed, 7 Aug 2024 14:38:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Receipts/ReceiptAppService.cs | 15 +++++++++++- .../Repositories/TbReceiptDetailRepository.cs | 12 +++++++++- .../Repositories/TbReceiptRepository.cs | 24 +++++++++++++++---- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs index 95f6ff8..eb3d183 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs @@ -13,6 +13,7 @@ using Volo.Abp.Uow; using Volo.Abp.Validation; using Win_in.Sfs.Scp.v1.Domain; using Volo.Abp.TenantManagement; +using Microsoft.IdentityModel.Logging; namespace Win_in.Sfs.Scp.WebApi { @@ -107,12 +108,23 @@ namespace Win_in.Sfs.Scp.WebApi /*flag = */ await _tbReceiptRepository.GetCountAsync(ObjectMapper.Map(entity)); await UpsertTbReceiptAndTbReceiptDetailAsync(entity, tenant.Id/*, flag*/); - await CurrentUnitOfWork.SaveChangesAsync(); + } } } catch (Exception ex) { + var qad = ObjectMapper.Map(entity); + LogHelper.LogInformation("TB_RECEIVE_QAD!Site = " + qad.Site + " ErpRecvBillNum = " + + qad.ErpRecvBillNum + " AsnBillNum = " + qad.AsnBillNum + " BillType = " + qad.BillType + " CreateTime = " + qad.CreateTime + + " State = " + qad.State + ); + var detail_qad = ObjectMapper.Map(entity); + LogHelper.LogInformation("TB_RECEIVE_DETAIL_QAD!Site = " + detail_qad.Site + " ErpRecvBillNum = " + + detail_qad.ErpRecvBillNum + " PoLine = " + detail_qad.PoLine + " BillType = " + detail_qad.BillType + " CreateTime = " + detail_qad.CreateTime + + " State = " + detail_qad.State + " qty = " + detail_qad.Qty + " DockCode = " + detail_qad.DockCode + " Batch =" + detail_qad.Batch + + " VendBatch = " + detail_qad.VendBatch + " Remark =" + detail_qad.Remark + " PoUnit= " + detail_qad.PoUnit + " Rate =" + detail_qad.Rate + ); var baseEx = ex.GetBaseException(); entity.ErrorCode = 1; entity.ErrorMessage = baseEx.Message; @@ -149,6 +161,7 @@ namespace Win_in.Sfs.Scp.WebApi tbReceiveDetail.TenantId = tenantId; //根据传入数据新增或修改SCP数据 await _tbReceiptDetailRepository.UpsertAsync(tbReceiveDetail); + await CurrentUnitOfWork.SaveChangesAsync(); } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptDetailRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptDetailRepository.cs index 8ca4b02..d5e4dec 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptDetailRepository.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptDetailRepository.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; +using Microsoft.IdentityModel.Logging; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Win_in.Sfs.Scp.v1.Domain; @@ -22,6 +23,11 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore if (current == null) { ret = await InsertAsync(tbReceiptDetail); + LogHelper.LogInformation("TB_RECEIVE_QAD不存在!Site = " + tbReceiptDetail.Site + " ErpRecvBillNum = " + + tbReceiptDetail.ErpRecvBillNum + " PoLine = " + tbReceiptDetail.PoLine + " BillType = " + tbReceiptDetail.BillType + " CreateTime = " + tbReceiptDetail.CreateTime + + " State = " + tbReceiptDetail.State +" qty = "+ tbReceiptDetail.Qty + " DockCode = " + tbReceiptDetail.DockCode + " Batch =" +tbReceiptDetail.Batch + + " VendBatch = " + tbReceiptDetail.VendBatch + " Remark ="+ tbReceiptDetail.Remark + " PoUnit= " + tbReceiptDetail.PoUnit + " Rate ="+ tbReceiptDetail.Rate + ); } else { @@ -42,7 +48,11 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore current.LocUnit = tbReceiptDetail.LocUnit; current.Rate = tbReceiptDetail.Rate; current.Extend3 = tbReceiptDetail.Extend3; - + LogHelper.LogInformation("TB_RECEIVE_QAD存在!Site = " + tbReceiptDetail.Site + " ErpRecvBillNum = " + + tbReceiptDetail.ErpRecvBillNum + " PoLine = " + tbReceiptDetail.PoLine + " BillType = " + tbReceiptDetail.BillType + " CreateTime = " + tbReceiptDetail.CreateTime + + " State = " + tbReceiptDetail.State + " qty = " + tbReceiptDetail.Qty + " DockCode = " + tbReceiptDetail.DockCode + " Batch =" + tbReceiptDetail.Batch + + " VendBatch = " + tbReceiptDetail.VendBatch + " Remark =" + tbReceiptDetail.Remark + " PoUnit= " + tbReceiptDetail.PoUnit + " Rate =" + tbReceiptDetail.Rate + ); ret = await UpdateAsync(current); } diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptRepository.cs index c7aaad8..a9c3d1f 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptRepository.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptRepository.cs @@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Logging; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.ObjectExtending; using Win_in.Sfs.Scp.v1.Domain; namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore @@ -22,6 +23,10 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore && p.ErpRecvBillNum == tbReceipt.ErpRecvBillNum); if (current == null) { + LogHelper.LogInformation("TB_RECEIVE_QAD不存在!Site = " + tbReceipt.Site + " ErpRecvBillNum = " + + tbReceipt.ErpRecvBillNum + " AsnBillNum = " + tbReceipt.AsnBillNum + " BillType = " + tbReceipt.BillType + " CreateTime = " + tbReceipt.CreateTime + + " State = " + tbReceipt.State + ); ret = await InsertAsync(tbReceipt); } else @@ -34,10 +39,13 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore current.Remark = tbReceipt.Remark; current.State = tbReceipt.State; current.BillType = tbReceipt.BillType; - + LogHelper.LogInformation("TB_RECEIVE_QAD存在!Site = " + tbReceipt.Site + " ErpRecvBillNum = " + + tbReceipt.ErpRecvBillNum + " AsnBillNum = " + tbReceipt.AsnBillNum + " BillType = " + tbReceipt.BillType + " CreateTime = " + tbReceipt.CreateTime + + " State = " + tbReceipt.State + ); ret = await UpdateAsync(current); } - + return ret; } public async Task GetCountAsync(TB_RECEIVE_QAD tbReceipt) @@ -54,10 +62,18 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore Console.WriteLine("TB_RECEIVE_QAD存在!Site = " + tbReceipt.Site + " ErpRecvBillNum = " + tbReceipt.ErpRecvBillNum + " AsnBillNum = " + tbReceipt.AsnBillNum + " BillType = " + tbReceipt.BillType + " CreateTime = " + tbReceipt.CreateTime); LogHelper.LogInformation("TB_RECEIVE_QAD存在!Site = " + tbReceipt.Site + " ErpRecvBillNum = " + - tbReceipt.ErpRecvBillNum + " AsnBillNum = " + tbReceipt.AsnBillNum + " BillType = " + tbReceipt.BillType + " CreateTime = " + tbReceipt.CreateTime); - + tbReceipt.ErpRecvBillNum + " AsnBillNum = " + tbReceipt.AsnBillNum + " BillType = " + tbReceipt.BillType + " CreateTime = " + tbReceipt.CreateTime + + " State = " + tbReceipt.State + ); } + else + { + LogHelper.LogInformation("TB_RECEIVE_QAD不存在!Site = " + tbReceipt.Site + " ErpRecvBillNum = " + + tbReceipt.ErpRecvBillNum + " AsnBillNum = " + tbReceipt.AsnBillNum + " BillType = " + tbReceipt.BillType + " CreateTime = " + tbReceipt.CreateTime+ + " State = "+ tbReceipt.State + ); + } return flag; }