Commit 7d3b6310 authored by liudong1993's avatar liudong1993

1

parent 412d4c35
...@@ -1211,6 +1211,154 @@ namespace REBORN.Module.FinanceModule ...@@ -1211,6 +1211,154 @@ namespace REBORN.Module.FinanceModule
}; };
RB_Finance_InfoChange_LogRepository.Insert(logModel); RB_Finance_InfoChange_LogRepository.Insert(logModel);
#endregion #endregion
#region 判断一下 是否合并单据的
//更新关联得 + 合并单
var frList = financeRelationRepository.GetList(new RB_FinanceRelation() { FinanceId = tmodel.FinanceId });
if (fmodel.Type == Common.Enum.User.WFTempLateClassEnum.OUT && frList.Any())
{
var fr2List = financeRelationRepository.GetList(new RB_FinanceRelation() { NewFinanceId = frList.FirstOrDefault().NewFinanceId });
fr2List = fr2List.Where(x => x.FinanceId != tmodel.FinanceId).ToList();
List<int> FrIds= new List<int>
{
frList.FirstOrDefault().NewFinanceId ?? 0
};
foreach (var fr in fr2List) {
if (fr.FinanceId != tmodel.FinanceId) {
FrIds.Add(fr.FinanceId ?? 0);
}
}
if (FrIds.Any())
{
var t2list = tradeWayRepository.GetByFinanceIds(string.Join(",", FrIds));
int num = 0;
foreach (var item in list)
{
Content = "";
var otmodel = tlist.Where(x => x.ID == item.ID).FirstOrDefault();
if (otmodel != null)
{
if (otmodel.Type == BranchAccountEnum.Bank)
{
var BankAccountModel = backAccountRepository.GetEntity(otmodel.AccountId);
if (BankAccountModel != null)
{
Content += "由【" + BankAccountModel.Alias + "】修改为";
}
}
else if (otmodel.Type == BranchAccountEnum.Cash)
{
var CashModel = cashAccountRepository.GetEntity(otmodel.AccountId);
if (CashModel != null)
{
Content += "由【" + CashModel.Alias + "】修改为";
}
}
else if (otmodel.Type == BranchAccountEnum.CashPool)
{
var CashPoolModel = cashPoolAccountRepository.GetEntity(otmodel.AccountId);
if (CashPoolModel != null)
{
Content += "由【" + CashPoolModel.Alias + "】修改为";
}
}
else if (otmodel.Type == BranchAccountEnum.Platform)
{
var PlatformModel = platformAccountRepository.GetEntity(otmodel.AccountId);
if (PlatformModel != null)
{
Content += "由【" + PlatformModel.Alias + "】修改为";
}
}
}
int CurrencyId = 0;
if (item.Type == BranchAccountEnum.Bank)
{
var BankAccountModel = backAccountRepository.GetEntity(item.AccountId);
if (BankAccountModel != null)
{
//是本位币
CurrencyId = BankAccountModel.CurrencyId ?? 0;
Content += "【" + BankAccountModel.Alias + "】;";
}
}
else if (item.Type == BranchAccountEnum.Cash)
{
var CashModel = cashAccountRepository.GetEntity(item.AccountId);
if (CashModel != null)
{
//是本位币
CurrencyId = CashModel.CurrencyId ?? 0;
Content += "【" + CashModel.Alias + "】;";
}
}
else if (item.Type == BranchAccountEnum.CashPool)
{
var CashPoolModel = cashPoolAccountRepository.GetEntity(item.AccountId);
if (CashPoolModel != null)
{
//是本位币
CurrencyId = CashPoolModel.CurrencyId ?? 0;
Content += "【" + CashPoolModel.Alias + "】;";
}
}
else if (item.Type == BranchAccountEnum.Platform)
{
var PlatformModel = platformAccountRepository.GetEntity(item.AccountId);
if (PlatformModel != null)
{
//是本位币
CurrencyId = PlatformModel.CurrencyId ?? 0;
Content += "【" + PlatformModel.Alias + "】;";
}
}
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_TradeWay_Extend.Type),item.Type},
{ nameof(RB_TradeWay_Extend.AccountId),item.AccountId},
};
if (CurrencyId > 0)
{
keyValues.Add(nameof(RB_TradeWay_Extend.CurrencyId), CurrencyId);
}
#region 匹配一下当前得
var tUpList = t2list.Where(x => x.Type == otmodel.Type && x.AccountId == otmodel.AccountId && x.OriginalMoney == otmodel.OriginalMoney).ToList();
#endregion
foreach (var tu in tUpList)
{
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_TradeWay_Extend.ID),
FiledValue=tu.ID,
OperatorEnum=OperatorEnum.Equal
}
};
tradeWayRepository.Update(keyValues, wheres);
if (num == 0) {
RB_Finance_Infochange_Log logModel2 = new RB_Finance_Infochange_Log
{
LogId = 0,
RB_Branch_id = userInfo.RB_Branch_id,
RB_Group_id = userInfo.RB_Group_id,
UpdateBy = userInfo.EmployeeId,
UpdateDate = System.DateTime.Now,
ResourceId = tu.FinanceId,
StartValue = "修改单据交易方式【"+ tmodel.FinanceId + "修改同步】" + Content,
Type = TemplateEnum.Process,
EndValue = "",
RB_UpdateByName = userInfo.emName
};
RB_Finance_InfoChange_LogRepository.Insert(logModel2);
}
}
num++;
}
}
}
#endregion
} }
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment