代码格式化

parent c6911236
......@@ -1096,112 +1096,112 @@ public void NewCopy(CopyRequest request)
logger.LogInformation($"copy workItems");
var workItems = _workitemRepository.GetEntities(t => t.AllotID == allot.ID);
//先判断是否为空,不为空删除再执行下面的代码
if (workItems!=null)
if (workItems != null)
{
_workitemRepository.RemoveRange(workItems.ToArray());
}
workItems = _workitemRepository.GetEntities(t => t.AllotID == allotId) ?? _workitemRepository.GetEntities(t => t.AllotID == -1);
if (workItems != null && workItems.Any())
{
var newWorkItems = workItems.Select(t => new cof_workitem { AllotID = allot.ID, Type = t.Type, Item = t.Item });
_workitemRepository.AddRange(newWorkItems.ToArray());
}
}
workItems = _workitemRepository.GetEntities(t => t.AllotID == allotId) ?? _workitemRepository.GetEntities(t => t.AllotID == -1);
if (workItems != null && workItems.Any())
{
var newWorkItems = workItems.Select(t => new cof_workitem { AllotID = allot.ID, Type = t.Type, Item = t.Item });
_workitemRepository.AddRange(newWorkItems.ToArray());
}
break;
case "drugTypes":
logger.LogInformation($"copy drugTypes");
var drugTypes = _drugtypeRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId);
if (drugTypes!=null)
if (drugTypes != null)
{
_drugtypeRepository.RemoveRange(drugTypes.ToArray());
}
var Types = _drugtypeRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId);
drugTypes = _drugtypeRepository.GetEntities(t => t.AllotID == allotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1);
if (drugTypes != null && drugTypes.Any())
{
var newDrugTypes = drugTypes.Select(t => new cof_drugtype { HospitalId = allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
_drugtypeRepository.AddRange(newDrugTypes.ToArray());
}
var Types = _drugtypeRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId);
drugTypes = _drugtypeRepository.GetEntities(t => t.AllotID == allotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1);
if (drugTypes != null && drugTypes.Any())
{
var newDrugTypes = drugTypes.Select(t => new cof_drugtype { HospitalId = allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
_drugtypeRepository.AddRange(newDrugTypes.ToArray());
}
break;
case "drugTypeDisburses":
logger.LogInformation($"copy drugTypeDisburses");
var drugTypeDisburses = drugtypeDisburseRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId);
if (drugTypeDisburses!=null)
if (drugTypeDisburses != null)
{
drugtypeDisburseRepository.RemoveRange(drugTypeDisburses.ToArray());
}
drugTypeDisburses = drugtypeDisburseRepository.GetEntities(t => t.AllotID == allotId) ?? drugtypeDisburseRepository.GetEntities(t => t.AllotID == -1);
if (drugTypeDisburses != null && drugTypeDisburses.Any())
{
var newDrugTypeDisburses = drugTypeDisburses.Select(t => new cof_drugtype_disburse { HospitalId = allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
drugtypeDisburseRepository.AddRange(newDrugTypeDisburses.ToArray());
}
}
drugTypeDisburses = drugtypeDisburseRepository.GetEntities(t => t.AllotID == allotId) ?? drugtypeDisburseRepository.GetEntities(t => t.AllotID == -1);
if (drugTypeDisburses != null && drugTypeDisburses.Any())
{
var newDrugTypeDisburses = drugTypeDisburses.Select(t => new cof_drugtype_disburse { HospitalId = allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
drugtypeDisburseRepository.AddRange(newDrugTypeDisburses.ToArray());
}
break;
case "drugTypeFactors":
logger.LogInformation($"copy drugTypeFactors");
var drugTypeFactors = cofdrugtypefactorRepository.GetEntities(t => t.AllotID == allot.ID);
if (drugTypeFactors!=null)
if (drugTypeFactors != null)
{
cofdrugtypefactorRepository.RemoveRange(drugTypeFactors.ToArray());
}
drugTypeFactors = cofdrugtypefactorRepository.GetEntities(t => t.AllotID == allotId) ?? cofdrugtypefactorRepository.GetEntities(t => t.AllotID == -1);
if (drugTypeFactors != null && drugTypeFactors.Any())
}
drugTypeFactors = cofdrugtypefactorRepository.GetEntities(t => t.AllotID == allotId) ?? cofdrugtypefactorRepository.GetEntities(t => t.AllotID == -1);
if (drugTypeFactors != null && drugTypeFactors.Any())
{
var newDrugtypeFactors = drugTypeFactors.Select(t => new cof_drugtype_factor
{
var newDrugtypeFactors = drugTypeFactors.Select(t => new cof_drugtype_factor
{
HospitalId = allot.HospitalId,
AllotID = allot.ID,
ExModuleId = t.ExModuleId,
Charge = t.Charge,
YSZ = t.YSZ,
HLZ = t.HLZ,
YJZ = t.YJZ
});
cofdrugtypefactorRepository.AddRange(newDrugtypeFactors.ToArray());
}
HospitalId = allot.HospitalId,
AllotID = allot.ID,
ExModuleId = t.ExModuleId,
Charge = t.Charge,
YSZ = t.YSZ,
HLZ = t.HLZ,
YJZ = t.YJZ
});
cofdrugtypefactorRepository.AddRange(newDrugtypeFactors.ToArray());
}
break;
case "deptTypes":
logger.LogInformation($"copy deptTypes");
var deptTypes = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allot.ID);
if (deptTypes!=null)
if (deptTypes != null)
{
perforCofdepttypeRepository.RemoveRange(deptTypes.ToArray());
}
deptTypes = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allotId) ?? perforCofdepttypeRepository.GetEntities(t => t.AllotID == -1);
if (deptTypes != null && deptTypes.Any())
{
var newDeptTypes = deptTypes.Select(t => new cof_depttype { AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
perforCofdepttypeRepository.AddRange(newDeptTypes.ToArray());
}
}
deptTypes = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allotId) ?? perforCofdepttypeRepository.GetEntities(t => t.AllotID == -1);
if (deptTypes != null && deptTypes.Any())
{
var newDeptTypes = deptTypes.Select(t => new cof_depttype { AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
perforCofdepttypeRepository.AddRange(newDeptTypes.ToArray());
}
break;
case "agains":
logger.LogInformation($"copy agains");
var agains = _againRepository.GetEntities(t => t.AllotID == allot.ID);
if (agains!=null)
if (agains != null)
{
_againRepository.RemoveRange(agains.ToArray());
}
agains = _againRepository.GetEntities(t => t.AllotID == allotId) ?? _againRepository.GetEntities(t => t.AllotID == -1);
if (agains != null && agains.Any())
{
var days = DateTime.DaysInMonth(allot.Year, allot.Month);
var newAgains = agains.Select(t => new cof_again { AllotID = allot.ID, Type = t.Type, Department = t.Department, TypeName = t.TypeName, Value = t.TypeName == "满勤天数" ? days : t.Value });
_againRepository.AddRange(newAgains.ToArray());
}
agains = _againRepository.GetEntities(t => t.AllotID == allotId) ?? _againRepository.GetEntities(t => t.AllotID == -1);
if (agains != null && agains.Any())
{
var days = DateTime.DaysInMonth(allot.Year, allot.Month);
var newAgains = agains.Select(t => new cof_again { AllotID = allot.ID, Type = t.Type, Department = t.Department, TypeName = t.TypeName, Value = t.TypeName == "满勤天数" ? days : t.Value });
_againRepository.AddRange(newAgains.ToArray());
}
break;
case "accountings":
logger.LogInformation($"copy accountings");
var accountings = cofaccountingRepository.GetEntities(t => t.AllotId == allot.ID);
if (accountings!=null)
if (accountings != null)
{
cofaccountingRepository.RemoveRange(accountings.ToArray());
}
accountings = cofaccountingRepository.GetEntities(t => t.AllotId == allotId) ?? cofaccountingRepository.GetEntities(t => t.AllotId == -1);
if (accountings != null && accountings.Any())
{
var newAccountings = accountings.Select(t => new cof_accounting { AllotId = allot.ID, UnitType = t.UnitType, AccountingUnit = t.AccountingUnit });
cofaccountingRepository.AddRange(newAccountings.ToArray());
}
}
accountings = cofaccountingRepository.GetEntities(t => t.AllotId == allotId) ?? cofaccountingRepository.GetEntities(t => t.AllotId == -1);
if (accountings != null && accountings.Any())
{
var newAccountings = accountings.Select(t => new cof_accounting { AllotId = allot.ID, UnitType = t.UnitType, AccountingUnit = t.AccountingUnit });
cofaccountingRepository.AddRange(newAccountings.ToArray());
}
break;
default:
break;
......
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