44673626
3 years ago
17 changed files with 578 additions and 210 deletions
Binary file not shown.
@ -0,0 +1,85 @@ |
|||
using Dapper; |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Repositories.Dapper; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Win.Sfs.SettleAccount.Entities; |
|||
using Win.Sfs.SettleAccount.Entities.Materials; |
|||
using Win.Sfs.SettleAccount.Entities.Prices; |
|||
using Win.Sfs.SettleAccount.Reports; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report |
|||
{ |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 主数据Dapper表
|
|||
/// </summary>
|
|||
public class ErpPartDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency |
|||
{ |
|||
public ErpPartDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public virtual List<T> GetDiffReport<T>(List<T> childList) where T : ReportDetailBase, new() |
|||
{ |
|||
List<Material> _materialList = new List<Material>(); |
|||
List<PriceList> _priceList = new List<PriceList>(); |
|||
if (CacheManager.CacheMaterials != null) |
|||
{ |
|||
_materialList = CacheManager.CacheMaterials; |
|||
} |
|||
else |
|||
{ |
|||
_materialList = DbConnection.Query<Material>("select * from set_material").ToList(); |
|||
} |
|||
if (CacheManager.CachePriceList != null) |
|||
{ |
|||
_priceList = CacheManager.CachePriceList; |
|||
} |
|||
else |
|||
{ |
|||
_priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList(); |
|||
} |
|||
|
|||
List<T> _list = new List<T>(); |
|||
foreach (var itm in childList) |
|||
{ |
|||
var parentMaterial = new T(); |
|||
parentMaterial.WmsBillNum = itm.WmsBillNum; |
|||
parentMaterial.CP5Time = itm.CP5Time; |
|||
parentMaterial.KENNCode = itm.KENNCode; |
|||
parentMaterial.ChassisNumber = itm.ChassisNumber; |
|||
parentMaterial.WmsState = itm.WmsState; |
|||
parentMaterial.SapMaterialCode = itm.ParentSapMaterialCode; |
|||
parentMaterial.MaterialDesc = itm.ParentMaterialDesc; |
|||
parentMaterial.MaterialCode = itm.ParentSapMaterialCode; |
|||
parentMaterial.ParentSapMaterialCode = itm.ParentSapMaterialCode; |
|||
parentMaterial.ParentMaterialDesc = itm.ParentMaterialDesc; |
|||
|
|||
var _price = _priceList.Where(p => p.MaterialCode == itm.ParentSapMaterialCode).FirstOrDefault(); |
|||
if (_price != null) |
|||
{ |
|||
parentMaterial.Price = _price.Price; |
|||
parentMaterial.Amt = _price.Price; |
|||
} |
|||
var _material = _materialList.Where(p => p.MaterialCode == itm.ParentSapMaterialCode).FirstOrDefault(); |
|||
if (_material != null) |
|||
{ |
|||
parentMaterial.MaterialGroup = _material.EstimateTypeDesc; |
|||
|
|||
} |
|||
_list.Add(parentMaterial); |
|||
} |
|||
|
|||
return _list; |
|||
|
|||
} |
|||
} |
|||
} |
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue