From c5b2655df8fe08dba490f39e2e081d71d398ad67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Sat, 2 Sep 2023 14:07:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BQ/Syncs/PendingDeductionService.cs | 118 ++++++++++++++---- 1 file changed, 91 insertions(+), 27 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 700b5535..9502619c 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 @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using EFCore.BulkExtensions; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.EntityFrameworkCore.Metadata.Conventions; using Newtonsoft.Json; using Nito.AsyncEx; using NPOI.OpenXmlFormats; @@ -48,39 +49,105 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, var isout = property.Where(p => p.Name == "IsOut").FirstOrDefault().Value; var list = billList.Split(","); var projectList = _dbcontext.Set().Where(p => p.Project == "库位"); - if (type == "JisBBAC") + + //JisBBAC + //JisHBPO + //ZhiGongJianBBAC + //ZhiGongJianHBPO + //MaiDanJianBBAC + //MaiDanJianHBPO + //BeiJian + //YinDuJian + if (type == "JisBBAC" || type == "ZhiGongJianBBAC" || type == "MaiDanJianBBAC" || type=="") { - var jisdetail = _dbcontext.Set().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisBBAC);//jis - Sync(jisdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout=="out"?true:false); - var mdetail = _dbcontext.Set().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianBBAC);//买单件 + var jisdetail = _dbcontext.Set().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisBBAC);//jis + if (jisdetail != null && jisdetail.Count() > 0) + { + foreach (var itm in jisdetail) + { + if (itm.Site == "1040" && string.IsNullOrEmpty(itm.Extend2)) + { + itm.Extend2 = "CC001"; + } + else + { + itm.Extend2 = "CC017"; + } + } + Sync(jisdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); + } + var mdetail = _dbcontext.Set().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianBBAC);//买单件 + if (mdetail !=null&&mdetail.Count() > 0) + { + foreach (var itm in jisdetail) + { + if (itm.Site == "1040" && string.IsNullOrEmpty(itm.Extend2)) + { + itm.Extend2 = "CC001"; + } + else + { + itm.Extend2 = "CC017"; + } + } Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); + } + var detailist1 = _dbcontext.Set().Where(p => list.Contains(p.BillNum)).ToList(); + if (detailist1 != null && detailist1.Count() > 0) + { + foreach (var itm in detailist1) + { + if (itm.Site == "1040" && string.IsNullOrEmpty(itm.Extend2)) + { + itm.Extend2 = "CC001"; + } + } + Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); + } + if (detailist1.Count > 0) + { + + var zgbbaclist = detailist1.Where(p => p.BusinessType == EnumBusinessType.ZhiGongJianHBPO).ToList(); + Sync(zgbbaclist, EnumDeliverBjBmpBillType.JIT直供件, isout == "out" ? true : false); + var ydlist = detailist1.Where(p => p.BusinessType == EnumBusinessType.YinDuJian).ToList(); + if (ydlist.Count > 0) + { + Sync(ydlist, EnumDeliverBjBmpBillType.印度件, isout == "out" ? true : false); + } + } } - else if (type == "JisHBPO") - { - var detailist = _dbcontext.Set().Where(p => list.Contains(p.BillNum) && p.BusinessType== EnumBusinessType.JisHBPO).ToList(); - Sync(detailist, EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); - var mdetail = _dbcontext.Set().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianHBPO);//买单件 - Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); - } - else + else if (type == "JisHBPO" || type == "ZhiGongJianHBPO" || type == "MaiDanJianHBPO") { - var detailist = _dbcontext.Set().Where(p => list.Contains(p.BillNum) ).ToList(); - var bjlist= detailist.Where(p => p.BusinessType == EnumBusinessType.BeiJian).ToList(); - if (bjlist.Count > 0) + var detailist = _dbcontext.Set().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisHBPO).ToList(); + foreach (var itm in detailist) { - Sync(detailist, EnumDeliverBjBmpBillType.北汽4S备件, isout == "out" ? true : false); + if ( string.IsNullOrEmpty(itm.Extend2)) + { + itm.Extend2 = "CC017"; + } } - var ydlist = detailist.Where(p => p.BusinessType == EnumBusinessType.YinDuJian).ToList(); - if (ydlist.Count > 0) + Sync(detailist, EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); + var mdetail = _dbcontext.Set().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianHBPO);//买单件 + foreach (var itm in mdetail) { - Sync(detailist, EnumDeliverBjBmpBillType.印度件, isout == "out" ? true : false); + if (string.IsNullOrEmpty(itm.Extend2)) + { + itm.Extend2 = "CC017"; + } } - var zglist = detailist.Where(p => p.BusinessType == EnumBusinessType.ZhiGongJianBBAC || p.BusinessType == EnumBusinessType.ZhiGongJianBBAC).ToList(); - if (zglist.Count > 0) + Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); + var detailist1 = _dbcontext.Set().Where(p => list.Contains(p.BillNum)).ToList(); + var zgbbaclist = detailist1.Where(p => p.BusinessType == EnumBusinessType.ZhiGongJianHBPO).ToList(); + foreach (var itm in zgbbaclist) { - Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件, isout == "out" ? true : false); + if (string.IsNullOrEmpty(itm.Extend2)) + { + itm.Extend2 = "CC017"; + } } + Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件, isout == "out" ? true : false); } + return id.ToString(); } public List GetPagedData(List dataList, int pageNumber, int pageSize) @@ -101,9 +168,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, 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() { @@ -123,10 +187,10 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, DeliverBillType=bussinessType, VinCode = itm.PN, OrderNum = itm.GroupNum, - ErpToLoc = string.IsNullOrEmpty(itm.Extend2)?"CC001":itm.Extend2, //寄售库 + ErpToLoc = itm.Extend2, //寄售库 }; var ls = query.ToList(); - + var _first= p_ls.FirstOrDefault(); using (var transaction =_dbcontext.Database.BeginTransaction()) {