|
@ -137,10 +137,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
} |
|
|
} |
|
|
Sync(bjlist, EnumDeliverBjBmpBillType.北汽4S备件, isout == "out" ? true : false); |
|
|
Sync(bjlist, EnumDeliverBjBmpBillType.北汽4S备件, isout == "out" ? true : false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else if (type == "JisHBPO" || type == "ZhiGongJianHBPO" || type == "MaiDanJianHBPO") |
|
|
else if (type == "JisHBPO" || type == "ZhiGongJianHBPO" || type == "MaiDanJianHBPO") |
|
@ -177,24 +173,26 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
|
|
|
|
|
|
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)
|
|
|
{ |
|
|
//{
|
|
|
int startIndex = (pageNumber - 1) * pageSize; |
|
|
// int startIndex = (pageNumber - 1) * pageSize;
|
|
|
|
|
|
|
|
|
return dataList.Skip(startIndex).Take(pageSize).ToList(); |
|
|
// return dataList.Skip(startIndex).Take(pageSize).ToList();
|
|
|
} |
|
|
//}
|
|
|
public int CalculatePageCount(int totalCount, int pageSize) |
|
|
//public int CalculatePageCount(int totalCount, int pageSize)
|
|
|
{ |
|
|
//{
|
|
|
int pageCount = totalCount / pageSize; |
|
|
// int pageCount = totalCount / pageSize;
|
|
|
if (totalCount % pageSize != 0) |
|
|
// if (totalCount % pageSize != 0)
|
|
|
{ |
|
|
// {
|
|
|
pageCount += 1; |
|
|
// pageCount += 1;
|
|
|
} |
|
|
// }
|
|
|
return pageCount; |
|
|
// return pageCount;
|
|
|
} |
|
|
//}
|
|
|
|
|
|
|
|
|
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() |
|
|
{ |
|
|
{ |
|
@ -218,8 +216,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
ErpToLoc = itm.Extend2, //寄售库
|
|
|
ErpToLoc = itm.Extend2, //寄售库
|
|
|
}; |
|
|
}; |
|
|
var ls = query.ToList(); |
|
|
var ls = query.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var itm in ls) |
|
|
foreach (var itm in ls) |
|
|
{ |
|
|
{ |
|
|
itm.SetId(GuidGenerator.Create()); |
|
|
itm.SetId(GuidGenerator.Create()); |
|
@ -232,11 +228,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
// 执行批量数据操作
|
|
|
// 执行批量数据操作
|
|
|
if (ls != null && ls.Count > 0) |
|
|
if (ls != null && ls.Count > 0) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var messagelist = new List<VmiMessage>(); |
|
|
var messagelist = new List<VmiMessage>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in ls) |
|
|
foreach (var item in ls) |
|
|
{ |
|
|
{ |
|
|
var message = new VmiMessage |
|
|
var message = new VmiMessage |
|
@ -245,41 +237,122 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
}; |
|
|
}; |
|
|
messagelist.Add(message); |
|
|
messagelist.Add(message); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_dbcontext.BulkInsert(messagelist); |
|
|
_dbcontext.BulkInsert(messagelist); |
|
|
_dbcontext.BulkInsert(ls, new BulkConfig() { }); |
|
|
_dbcontext.BulkInsert(ls, new BulkConfig() { }); |
|
|
|
|
|
var billList = p_ls.Select(p => p.BillNum).Distinct().ToList(); |
|
|
|
|
|
var pdList = _dbcontext.Set<PUB_PD>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
|
|
|
if (pdList.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var item in pdList) |
|
|
|
|
|
{ |
|
|
|
|
|
if (flag == true) |
|
|
|
|
|
{ |
|
|
|
|
|
item.State = SettleBillState.已扣减; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
item.State = SettleBillState.客户已收票; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
_dbcontext.BulkUpdate(pdList); |
|
|
//var count = CalculatePageCount(ls.Count, 2000);
|
|
|
} |
|
|
//for (int pagenumber = 0; pagenumber < count; pagenumber++)
|
|
|
var bbacList = _dbcontext.Set<BBAC_PD>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
//{
|
|
|
if (bbacList.Count > 0) |
|
|
// var lst = GetPagedData(ls, pagenumber++, 2000);
|
|
|
{ |
|
|
// var messagelist= new List<VmiMessage>();
|
|
|
foreach (var item in bbacList) |
|
|
// foreach (var item in lst)
|
|
|
{ |
|
|
// {
|
|
|
if (flag == true) |
|
|
// var message = new VmiMessage
|
|
|
{ |
|
|
// {
|
|
|
item.State = SettleBillState.已扣减; |
|
|
// Message = System.Text.Json.JsonSerializer.Serialize(item),
|
|
|
} |
|
|
// };
|
|
|
else |
|
|
// messagelist.Add(message);
|
|
|
{ |
|
|
// }
|
|
|
item.State = SettleBillState.客户已收票; |
|
|
// _dbcontext.BulkInsert(messagelist);
|
|
|
} |
|
|
// _dbcontext.BulkInsert(lst,new BulkConfig() { });
|
|
|
} |
|
|
// Task.Delay(500);
|
|
|
_dbcontext.BulkUpdate(bbacList); |
|
|
//}
|
|
|
} |
|
|
|
|
|
var hbpoList = _dbcontext.Set<HBPO_PD>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
|
|
|
if (hbpoList.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var item in hbpoList) |
|
|
|
|
|
{ |
|
|
|
|
|
if (flag == true) |
|
|
|
|
|
{ |
|
|
|
|
|
item.State = SettleBillState.已扣减; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
item.State = SettleBillState.客户已收票; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
_dbcontext.BulkUpdate(hbpoList); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
// 提交事务
|
|
|
// 提交事务
|
|
|
transaction.Commit(); |
|
|
transaction.Commit(); |
|
|
} |
|
|
} |
|
|
catch (Exception) |
|
|
catch (Exception) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var billList = p_ls.Select(p => p.BillNum).Distinct().ToList(); |
|
|
|
|
|
var pdList = _dbcontext.Set<PUB_PD>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
|
|
|
if (pdList.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var item in pdList) |
|
|
|
|
|
{ |
|
|
|
|
|
if (flag == true) |
|
|
|
|
|
{ |
|
|
|
|
|
item.State = SettleBillState.客户已收票; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
item.State = SettleBillState.已扣减; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
_dbcontext.BulkUpdate(pdList); |
|
|
|
|
|
} |
|
|
|
|
|
var bbacList = _dbcontext.Set<BBAC_PD>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
|
|
|
if (bbacList.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var item in bbacList) |
|
|
|
|
|
{ |
|
|
|
|
|
if (flag == true) |
|
|
|
|
|
{ |
|
|
|
|
|
item.State = SettleBillState.客户已收票; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
item.State = SettleBillState.已扣减; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
_dbcontext.BulkUpdate(bbacList); |
|
|
|
|
|
} |
|
|
|
|
|
var hbpoList = _dbcontext.Set<HBPO_PD>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
|
|
|
if (hbpoList.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var item in hbpoList) |
|
|
|
|
|
{ |
|
|
|
|
|
if (flag == true) |
|
|
|
|
|
{ |
|
|
|
|
|
item.State = SettleBillState.客户已收票; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
item.State = SettleBillState.已扣减; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
_dbcontext.BulkUpdate(hbpoList); |
|
|
|
|
|
} |
|
|
// 回滚事务
|
|
|
// 回滚事务
|
|
|
transaction.Rollback(); |
|
|
transaction.Rollback(); |
|
|
throw; |
|
|
throw; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|