|
|
@ -36,7 +36,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
|
_dbcontext = dbcontext; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
[UnitOfWork(false)] |
|
|
|
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) |
|
|
|
{ |
|
|
|
|
|
|
@ -48,22 +48,35 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
|
if (type == "JisBBAC") |
|
|
|
{ |
|
|
|
var jisdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisBBAC);//jis
|
|
|
|
Sync(jisdetail.ToList(),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);//买单件
|
|
|
|
Sync(mdetail.ToList(), isout == "out" ? true : false); |
|
|
|
Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, 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, isout == "out" ? true : false); |
|
|
|
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(),isout == "out" ? true : false); |
|
|
|
Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var detailist = _dbcontext.Set<PUB_PD_DETAIL>().Where(p => list.Contains(p.BillNum)).ToList(); |
|
|
|
Sync(detailist, isout == "out" ? true : false); |
|
|
|
|
|
|
|
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) |
|
|
|
{ |
|
|
|
Sync(detailist, EnumDeliverBjBmpBillType.北汽4S备件, isout == "out" ? true : false); |
|
|
|
} |
|
|
|
var ydlist = detailist.Where(p => p.BusinessType == EnumBusinessType.YinDuJian).ToList(); |
|
|
|
if (ydlist.Count > 0) |
|
|
|
{ |
|
|
|
Sync(detailist, EnumDeliverBjBmpBillType.印度件, isout == "out" ? true : false); |
|
|
|
} |
|
|
|
var zglist = detailist.Where(p => p.BusinessType == EnumBusinessType.ZhiGongJianBBAC || p.BusinessType == EnumBusinessType.ZhiGongJianBBAC).ToList(); |
|
|
|
if (zglist.Count > 0) |
|
|
|
{ |
|
|
|
Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件, isout == "out" ? true : false); |
|
|
|
} |
|
|
|
} |
|
|
|
return id.ToString(); |
|
|
|
} |
|
|
@ -83,19 +96,19 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
|
return pageCount; |
|
|
|
} |
|
|
|
|
|
|
|
public void Sync<T>(List<T> p_ls,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 |
|
|
|
select new VmiLog() |
|
|
|
{ |
|
|
|
|
|
|
|
CodeType=string.Empty, |
|
|
|
BillTime = DateTime.Now, |
|
|
|
ChangedTime = DateTime.Now, |
|
|
|
Qty = itm.Qty, |
|
|
|
RealPartCode=itm.RELU, |
|
|
|
|
|
|
|
RealPartCode=itm.RELU,//替换件 结算数据 RealPartCode->RELU
|
|
|
|
RealCode=itm.RELU, |
|
|
|
|
|
|
|
LogType = Entities.BQ.Vmi.VmiLogType.Type200, |
|
|
|
ChangedQty =(flag==true)? -itm.Qty:itm.Qty, |
|
|
|
ChangedType = VmiType.Out, |
|
|
@ -103,26 +116,16 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
|
//BillType = EnumDeliverBjBmpBillType.JIS件,
|
|
|
|
CustPartCode = itm.LU, |
|
|
|
SettlementVinCode = itm.PN, |
|
|
|
|
|
|
|
DeliverBillType=bussinessType, |
|
|
|
VinCode = itm.PN, |
|
|
|
OrderNum = itm.GroupNum, |
|
|
|
ErpToLoc = string.IsNullOrEmpty(itm.Extend2)?string.Empty:itm.Extend2, |
|
|
|
ErpToLoc = string.IsNullOrEmpty(itm.Extend2)?"CC001":itm.Extend2, //寄售库
|
|
|
|
|
|
|
|
}; |
|
|
|
var ls = query.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _first= p_ls.FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (var transaction =_dbcontext.Database.BeginTransaction()) |
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
// 执行批量数据操作
|
|
|
@ -135,13 +138,12 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
|
foreach (var item in ls) |
|
|
|
{ |
|
|
|
item.SetId(GuidGenerator.Create()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
_dbcontext.BulkInsert(ls); |
|
|
|
Task.Delay(500); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 提交事务
|
|
|
|
transaction.Commit(); |
|
|
|
} |
|
|
|