From bcddf185a669dfaa4a9c568d384aeda1a06f1cce Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Sat, 2 Sep 2023 17:29:42 +0800 Subject: [PATCH 1/2] update --- .../host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js | 1 + 1 file changed, 1 insertion(+) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js index d4216156..940222c0 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js @@ -15,6 +15,7 @@ const stateOptions = [ { value: 3, label: "财务已审核" }, { value: 4, label: "客户已收票" }, { value: 5, label: "已扣减" }, + { value: 6, label: "已提交扣减" }, ]; const state = { title: "状态", type: "string", input: "select", options: stateOptions }; const state2 = Object.assign(Object.assign({}, state), { options: stateOptions.filter((a) => parseInt(a.value) > 0) }); From bda06f4724e5d2618681281b6e540a0958e61510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Mon, 4 Sep 2023 09:16:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BQ/Syncs/PendingDeductionService.cs | 169 +++++++++++++----- 1 file changed, 121 insertions(+), 48 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs index 07b71e79..b55db613 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs @@ -137,10 +137,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, } Sync(bjlist, EnumDeliverBjBmpBillType.北汽4S备件, isout == "out" ? true : false); } - - - - } } else if (type == "JisHBPO" || type == "ZhiGongJianHBPO" || type == "MaiDanJianHBPO") @@ -177,24 +173,26 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, return id.ToString(); } - public List GetPagedData(List dataList, int pageNumber, int pageSize) - { - int startIndex = (pageNumber - 1) * pageSize; + //public List GetPagedData(List dataList, int pageNumber, int pageSize) + //{ + // int startIndex = (pageNumber - 1) * pageSize; - return dataList.Skip(startIndex).Take(pageSize).ToList(); - } - public int CalculatePageCount(int totalCount, int pageSize) - { - int pageCount = totalCount / pageSize; - if (totalCount % pageSize != 0) - { - pageCount += 1; - } - return pageCount; - } + // return dataList.Skip(startIndex).Take(pageSize).ToList(); + //} + //public int CalculatePageCount(int totalCount, int pageSize) + //{ + // int pageCount = totalCount / pageSize; + // if (totalCount % pageSize != 0) + // { + // pageCount += 1; + // } + // return pageCount; + //} public void Sync(List p_ls, EnumDeliverBjBmpBillType bussinessType, bool flag=true) where T : PD_BASE,new() { + + var query = from itm in p_ls select new VmiLog() { @@ -218,8 +216,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, ErpToLoc = itm.Extend2, //寄售库 }; var ls = query.ToList(); - - foreach (var itm in ls) { itm.SetId(GuidGenerator.Create()); @@ -232,11 +228,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, // 执行批量数据操作 if (ls != null && ls.Count > 0) { - - var messagelist = new List(); - - foreach (var item in ls) { var message = new VmiMessage @@ -245,41 +237,122 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, }; messagelist.Add(message); } + _dbcontext.BulkInsert(messagelist); + _dbcontext.BulkInsert(ls, new BulkConfig() { }); + var billList = p_ls.Select(p => p.BillNum).Distinct().ToList(); + var pdList = _dbcontext.Set().Where(p => billList.Contains(p.BillNum)).ToList(); + if (pdList.Count > 0) + { + foreach (var item in pdList) + { + if (flag == true) + { + item.State = SettleBillState.已扣减; + } + else + { + item.State = SettleBillState.客户已收票; + } - _dbcontext.BulkInsert(messagelist); - _dbcontext.BulkInsert(ls,new BulkConfig() { }); - - - - //var count = CalculatePageCount(ls.Count, 2000); - //for (int pagenumber = 0; pagenumber < count; pagenumber++) - //{ - // var lst = GetPagedData(ls, pagenumber++, 2000); - // var messagelist= new List(); - // foreach (var item in lst) - // { - // var message = new VmiMessage - // { - // Message = System.Text.Json.JsonSerializer.Serialize(item), - // }; - // messagelist.Add(message); - // } - // _dbcontext.BulkInsert(messagelist); - // _dbcontext.BulkInsert(lst,new BulkConfig() { }); - // Task.Delay(500); - //} + } + _dbcontext.BulkUpdate(pdList); + } + var bbacList = _dbcontext.Set().Where(p => billList.Contains(p.BillNum)).ToList(); + if (bbacList.Count > 0) + { + foreach (var item in bbacList) + { + if (flag == true) + { + item.State = SettleBillState.已扣减; + } + else + { + item.State = SettleBillState.客户已收票; + } + } + _dbcontext.BulkUpdate(bbacList); + } + var hbpoList = _dbcontext.Set().Where(p => billList.Contains(p.BillNum)).ToList(); + if (hbpoList.Count > 0) + { + foreach (var item in hbpoList) + { + if (flag == true) + { + item.State = SettleBillState.已扣减; + } + else + { + item.State = SettleBillState.客户已收票; + } + } + _dbcontext.BulkUpdate(hbpoList); + } } // 提交事务 transaction.Commit(); } catch (Exception) { + var billList = p_ls.Select(p => p.BillNum).Distinct().ToList(); + var pdList = _dbcontext.Set().Where(p => billList.Contains(p.BillNum)).ToList(); + if (pdList.Count > 0) + { + foreach (var item in pdList) + { + if (flag == true) + { + item.State = SettleBillState.客户已收票; + } + else + { + item.State = SettleBillState.已扣减; + + } + + } + _dbcontext.BulkUpdate(pdList); + } + var bbacList = _dbcontext.Set().Where(p => billList.Contains(p.BillNum)).ToList(); + if (bbacList.Count > 0) + { + foreach (var item in bbacList) + { + if (flag == true) + { + item.State = SettleBillState.客户已收票; + } + else + { + item.State = SettleBillState.已扣减; + + } + } + _dbcontext.BulkUpdate(bbacList); + } + var hbpoList = _dbcontext.Set().Where(p => billList.Contains(p.BillNum)).ToList(); + if (hbpoList.Count > 0) + { + foreach (var item in hbpoList) + { + if (flag == true) + { + item.State = SettleBillState.客户已收票; + } + else + { + item.State = SettleBillState.已扣减; + + } + } + _dbcontext.BulkUpdate(hbpoList); + } // 回滚事务 transaction.Rollback(); throw; } - } - + } }