|
|
@ -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<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
|
|
|
|
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 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); |
|
|
|
} |
|
|
|
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); |
|
|
|
} |
|
|
|
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") |
|
|
|
{ |
|
|
|
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 |
|
|
|
else if (type == "JisHBPO" || type == "ZhiGongJianHBPO" || type == "MaiDanJianHBPO") |
|
|
|
{ |
|
|
|
var detailist = _dbcontext.Set<PUB_PD_DETAIL>().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<HBPO_PD_DETAIL>().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<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(); |
|
|
|
if (zglist.Count > 0) |
|
|
|
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) |
|
|
|
{ |
|
|
|
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<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() |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()) |
|
|
|
{ |
|
|
|