Merge branch '4.80' of https://git.aycode.com/Adam/Mango.Nop.Plugins into 4.80
This commit is contained in:
commit
9cb032db3d
|
|
@ -1,4 +1,5 @@
|
|||
using FruitBank.Common.Entities;
|
||||
using FruitBank.Common.Interfaces;
|
||||
using LinqToDB;
|
||||
using Mango.Nop.Core.Repositories;
|
||||
using Nop.Core.Caching;
|
||||
|
|
@ -18,13 +19,15 @@ public class ShippingItemDbTable : MgDbTableBase<ShippingItem>
|
|||
|
||||
protected override void OnUpdate(ShippingItem entity)
|
||||
{
|
||||
RoundMeasuredValue(entity);
|
||||
PrepareValues(entity);
|
||||
base.OnUpdate(entity);
|
||||
}
|
||||
|
||||
protected override void OnInsert(ShippingItem entity)
|
||||
{
|
||||
RoundMeasuredValue(entity);
|
||||
entity.MeasuringCount = entity.PalletsOnDocument;
|
||||
|
||||
PrepareValues(entity);
|
||||
base.OnInsert(entity);
|
||||
}
|
||||
|
||||
|
|
@ -56,8 +59,10 @@ public class ShippingItemDbTable : MgDbTableBase<ShippingItem>
|
|||
public IQueryable<ShippingItem> GetAllByShippingDocumentIdAsync(int shippingDocumentId, bool loadRelations)
|
||||
=> GetAll(loadRelations).Where(si => si.ShippingDocumentId == shippingDocumentId);
|
||||
|
||||
private static void RoundMeasuredValue(ShippingItem shippingItem)
|
||||
private static void PrepareValues(ShippingItem shippingItem)
|
||||
{
|
||||
if (shippingItem.MeasuringCount < 1) shippingItem.MeasuringCount = 1;
|
||||
|
||||
shippingItem.MeasuredNetWeight = double.Round(shippingItem.MeasuredNetWeight, 1);
|
||||
shippingItem.MeasuredGrossWeight = double.Round(shippingItem.MeasuredGrossWeight, 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue