Browse Source

版本更新

master
学 赵 1 year ago
parent
commit
c5b2655df8
  1. 118
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs

118
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs

@ -7,6 +7,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
using Newtonsoft.Json; using Newtonsoft.Json;
using Nito.AsyncEx; using Nito.AsyncEx;
using NPOI.OpenXmlFormats; using NPOI.OpenXmlFormats;
@ -48,39 +49,105 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
var isout = property.Where(p => p.Name == "IsOut").FirstOrDefault().Value; var isout = property.Where(p => p.Name == "IsOut").FirstOrDefault().Value;
var list = billList.Split(","); var list = billList.Split(",");
var projectList = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "库位"); var projectList = _dbcontext.Set<CodeSetting>().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<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisBBAC);//jis var jisdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisBBAC);//jis
Sync(jisdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout=="out"?true:false); if (jisdetail != null && jisdetail.Count() > 0)
var mdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianBBAC);//买单件 {
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<BBAC_PD_DETAIL>().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); Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
}
var detailist1 = _dbcontext.Set<PUB_PD_DETAIL>().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") else if (type == "JisHBPO" || type == "ZhiGongJianHBPO" || type == "MaiDanJianHBPO")
{
var detailist = _dbcontext.Set<HBPO_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType== EnumBusinessType.JisHBPO).ToList();
Sync(detailist, EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
var mdetail = _dbcontext.Set<HBPO_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianHBPO);//买单件
Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
}
else
{ {
var detailist = _dbcontext.Set<PUB_PD_DETAIL>().Where(p => list.Contains(p.BillNum) ).ToList(); var detailist = _dbcontext.Set<HBPO_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisHBPO).ToList();
var bjlist= detailist.Where(p => p.BusinessType == EnumBusinessType.BeiJian).ToList(); foreach (var itm in detailist)
if (bjlist.Count > 0)
{ {
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(); Sync(detailist, EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
if (ydlist.Count > 0) var mdetail = _dbcontext.Set<HBPO_PD_DETAIL>().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(); Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
if (zglist.Count > 0) var detailist1 = _dbcontext.Set<PUB_PD_DETAIL>().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(); return id.ToString();
} }
public List<T> GetPagedData<T>(List<T> dataList, int pageNumber, int pageSize) public List<T> GetPagedData<T>(List<T> dataList, int pageNumber, int pageSize)
@ -101,9 +168,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
public void Sync<T>(List<T> p_ls, EnumDeliverBjBmpBillType bussinessType, bool flag=true) where T : PD_BASE,new() public void Sync<T>(List<T> p_ls, EnumDeliverBjBmpBillType bussinessType, bool flag=true) where T : PD_BASE,new()
{ {
var query = from itm in p_ls var query = from itm in p_ls
select new VmiLog() select new VmiLog()
{ {
@ -123,10 +187,10 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
DeliverBillType=bussinessType, DeliverBillType=bussinessType,
VinCode = itm.PN, VinCode = itm.PN,
OrderNum = itm.GroupNum, OrderNum = itm.GroupNum,
ErpToLoc = string.IsNullOrEmpty(itm.Extend2)?"CC001":itm.Extend2, //寄售库 ErpToLoc = itm.Extend2, //寄售库
}; };
var ls = query.ToList(); var ls = query.ToList();
var _first= p_ls.FirstOrDefault(); var _first= p_ls.FirstOrDefault();
using (var transaction =_dbcontext.Database.BeginTransaction()) using (var transaction =_dbcontext.Database.BeginTransaction())
{ {

Loading…
Cancel
Save