The open source simple and complete warehouse management system is derived from our many years of experience in implementing erp projects. We stripped the original commercial system wms function and opened it up for free, hoping to help the majority of small and medium-sized enterprises. At present, the system supports cross-platform。
fix ef core for sqlite can not support sum function for the data of decimal type problem
JawerZengd5d955978ed6
diff --git a/backend/ModernWMS.WMS/Services/Dispatchlist/DispatchlistService.cs b/backend/ModernWMS.WMS/Services/Dispatchlist/DispatchlistService.csindex 0a4682b..b585b4a 100644--- a/backend/ModernWMS.WMS/Services/Dispatchlist/DispatchlistService.cs+++ b/backend/ModernWMS.WMS/Services/Dispatchlist/DispatchlistService.cs@@ -349,9 +349,9 @@ namespace ModernWMS.WMS.Services}var DbSet = _dBContext.GetDbSet<DispatchlistEntity>();var query = from d in DbSet.AsNoTracking().Where(t => t.tenant_id.Equals(currentUser.tenant_id))- join sku in _dBContext.GetDbSet<SkuEntity>().AsNoTracking() on d.sku_id equals sku.id- join spu in _dBContext.GetDbSet<SpuEntity>().AsNoTracking() on sku.spu_id equals spu.id- group new { d, spu } by new { d.dispatch_no, d.dispatch_status, d.customer_id, d.customer_name, d.creator }+ //join sku in _dBContext.GetDbSet<SkuEntity>().AsNoTracking() on d.sku_id equals sku.id+ //join spu in _dBContext.GetDbSet<SpuEntity>().AsNoTracking() on sku.spu_id equals spu.id+ group new { d/*, spu*/ } by new { d.dispatch_no, d.dispatch_status, d.customer_id, d.customer_name, d.creator }into dgselect new PreDispatchlistViewModel{@@ -360,9 +360,15 @@ namespace ModernWMS.WMS.Servicescustomer_id = dg.Key.customer_id,customer_name = dg.Key.customer_name,qty = dg.Sum(t => t.d.qty),- volume = dg.Sum(t => t.spu.volume_unit == 1 ? t.d.volume : (t.spu.volume_unit == 0 ? t.d.volume / 1000 : t.d.volume * 1000)),- weight = dg.Sum(t => t.spu.weight_unit == 0 ? t.d.weight / 1000000 : (t.spu.weight_unit == 1 ? t.d.weight / 1000 : t.d.weight)),creator = dg.Key.creator,+ /*dispatch_no = dg.Key.dispatch_no,+ dispatch_status = dg.Key.dispatch_status,+ customer_id = dg.Key.customer_id,+ customer_name = dg.Key.customer_name,+ qty = dg.Sum(t => t.d.qty),+ volume = dg.Sum(t =>t.spu.volume_unit==1? t.d.volume:(t.spu.volume_unit==0?t.d.volume/1000:t.d.volume*1000)),+ weight = dg.Sum(t =>t.spu.weight_unit==0?t.d.weight/1000000:(t.spu.weight_unit==1? t.d.weight/1000:t.d.weight)),+ creator = dg.Key.creator,*/};query = query.Where(queries.AsExpression<PreDispatchlistViewModel>());if (pageSearch.sqlTitle.Contains("dispatch_status"))@@ -375,6 +381,24 @@ namespace ModernWMS.WMS.Services.Skip((pageSearch.pageIndex - 1) * pageSearch.pageSize).Take(pageSearch.pageSize).ToListAsync();+ #region sqlit cannot sum data of decimal type+ var dispatch_no_list = list.Select(t => t.dispatch_no).Distinct().ToList();+ var d_datas = await (from d in DbSet.AsNoTracking()+ join sku in _dBContext.GetDbSet<SkuEntity>().AsNoTracking() on d.sku_id equals sku.id+ join spu in _dBContext.GetDbSet<SpuEntity>().AsNoTracking() on sku.spu_id equals spu.id+ where d.tenant_id == currentUser.tenant_id && dispatch_no_list.Contains(d.dispatch_no)+ select new+ {+ d.dispatch_no,+ volume = spu.volume_unit == 1 ? d.volume : (spu.volume_unit == 0 ? d.volume / 1000 : d.volume * 1000),+ weight = spu.weight_unit == 0 ? d.weight / 1000000 : (spu.weight_unit == 1 ? d.weight / 1000 : d.weight)+ }).ToListAsync();+ list.ForEach(t =>+ {+ t.volume = d_datas.Where(d => d.dispatch_no == t.dispatch_no).Sum(t => t.volume);+ t.weight = d_datas.Where(d => d.dispatch_no == t.dispatch_no).Sum(t => t.weight);+ });+ #endregionreturn (list, totals);}/// <summary>