Browse Source

版本更新

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

104
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
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); 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);//买单件 var mdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianBBAC);//买单件
Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); if (mdetail !=null&&mdetail.Count() > 0)
{
foreach (var itm in jisdetail)
{
if (itm.Site == "1040" && string.IsNullOrEmpty(itm.Extend2))
{
itm.Extend2 = "CC001";
} }
else if (type == "JisHBPO") else
{ {
var detailist = _dbcontext.Set<HBPO_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType== EnumBusinessType.JisHBPO).ToList(); itm.Extend2 = "CC017";
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); Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
} }
else 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)
{ {
var detailist = _dbcontext.Set<PUB_PD_DETAIL>().Where(p => list.Contains(p.BillNum) ).ToList(); if (itm.Site == "1040" && string.IsNullOrEmpty(itm.Extend2))
var bjlist= detailist.Where(p => p.BusinessType == EnumBusinessType.BeiJian).ToList();
if (bjlist.Count > 0)
{ {
Sync(detailist, EnumDeliverBjBmpBillType.4S备件, isout == "out" ? true : false); itm.Extend2 = "CC001";
}
}
Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
} }
var ydlist = detailist.Where(p => p.BusinessType == EnumBusinessType.YinDuJian).ToList(); 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) if (ydlist.Count > 0)
{ {
Sync(detailist, EnumDeliverBjBmpBillType., isout == "out" ? true : false); Sync(ydlist, EnumDeliverBjBmpBillType., isout == "out" ? true : false);
}
}
} }
var zglist = detailist.Where(p => p.BusinessType == EnumBusinessType.ZhiGongJianBBAC || p.BusinessType == EnumBusinessType.ZhiGongJianBBAC).ToList(); else if (type == "JisHBPO" || type == "ZhiGongJianHBPO" || type == "MaiDanJianHBPO")
if (zglist.Count > 0)
{ {
Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件, isout == "out" ? true : false); var detailist = _dbcontext.Set<HBPO_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisHBPO).ToList();
foreach (var itm in detailist)
{
if ( string.IsNullOrEmpty(itm.Extend2))
{
itm.Extend2 = "CC017";
}
} }
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);//买单件
foreach (var itm in mdetail)
{
if (string.IsNullOrEmpty(itm.Extend2))
{
itm.Extend2 = "CC017";
} }
}
Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
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)
{
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,7 +187,7 @@ 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();

Loading…
Cancel
Save