B3代宰模块
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

36 lines
1.2 KiB

using BWP.B3Frameworks.BL;
using BWP.B3SubstituteKill.BO;
using BWP.B3SubstituteKill.Rpcs;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.BusinessInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3SubstituteKill.BL
{
[BusinessInterface(typeof(SubKillWeightBillBL))]
[LogicName("代宰过磅")]
public interface ISubKillWeightBillBL : IDepartmentWorkFlowBillBL<SubKillWeightBill>
{ }
public class SubKillWeightBillBL : DepartmentWorkFlowBillBL<SubKillWeightBill>, ISubKillWeightBillBL
{
protected override void beforeSave(SubKillWeightBill dmo)
{
foreach (var detail in dmo.Details)
{
if (detail.MaoWeight.HasValue || detail.PiWeight.HasValue)
detail.Weight = (detail.MaoWeight ?? 0) - (detail.PiWeight ?? 0);
}
dmo.PriceBill_ID = null;
if (dmo.Date.HasValue && dmo.Supplier_ID.HasValue)
dmo.PriceBill_ID = SupplierRpc.GetPriceBillID(dmo.Supplier_ID.Value, dmo.Date.Value);
dmo.Number = dmo.Details.Sum(x => x.Number ?? 0);
dmo.Weight = dmo.Details.Sum(x => x.Weight.EToDecimal() ?? 0);
base.beforeSave(dmo);
}
}
}