Browse Source

需求单No.139892 万福模块 过磅 结算 付款业务调整。

master
yibo 7 years ago
parent
commit
b00520e0a1
13 changed files with 190 additions and 67 deletions
  1. +12
    -1
      B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj
  2. +20
    -5
      B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/PayEdit_Ext.cs
  3. +26
    -0
      B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/SelectStatPayDialog_Ext.cs
  4. +1
    -0
      B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayEdit_Ext.cs
  5. +13
    -0
      B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayList_Ext.cs
  6. +25
    -0
      B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/WeighBillList_Ext.cs
  7. +17
    -0
      B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/WeightBillEdit_Ext.cs
  8. +1
    -28
      B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/StatPayAnalyse.cs
  9. +4
    -0
      B3QingDaoWanFu.Web/PluginClass.cs
  10. +1
    -0
      B3QingDaoWanFu/B3QingDaoWanFu.csproj
  11. +2
    -0
      B3QingDaoWanFu/TypeIOCs/PayBLTypeIoc.cs
  12. +47
    -33
      B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs
  13. +21
    -0
      B3QingDaoWanFu/TypeIOCs/WeightBillTypeIoc.cs

+ 12
- 1
B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj View File

@ -170,10 +170,21 @@
<Compile Include="Pages\B3QingDaoWanFu\ExportUI\GoodsExportToMES.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3QingDaoWanFu\Overlays\PayAnalyse_Ext.cs" />
<Compile Include="Pages\B3QingDaoWanFu\Overlays\PayAnalyse_Ext.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3QingDaoWanFu\Overlays\PayEdit_Ext.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3QingDaoWanFu\Overlays\SelectStatPayDialog_Ext.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3QingDaoWanFu\Overlays\WeighBillList_Ext.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3QingDaoWanFu\Overlays\WeightBillEdit_Ext.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3QingDaoWanFu\TrustPay_\TrustPayList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>


+ 20
- 5
B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/PayEdit_Ext.cs View File

@ -14,6 +14,8 @@ using BWP.B3ButcherManage.NamedValueTemplate;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.SqlDoms;
using TSingSoft.WebPluginFramework;
using Forks.Utils;
namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays
{
@ -28,10 +30,6 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays
protected override void BuildBody(System.Web.UI.Control control)
{
base.BuildBody(control);
if (CanSave)
{
dialogButton.BeforeClientClick += " var pt=__DFContainer.getValue('PayTarget'); if (pt == '') { alert('先选择付款对象');return false;}";
}
AddFarmerDetails(control.EAdd(new TitlePanel("养殖户明细", "养殖户明细")));
}
@ -62,7 +60,12 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays
protected override void AfterSelectedStatPay(IList<Pay_Detail> payDetails)
{
_farmerGrid.GetFromUI();
mDFContainer.GetFromUIParitially("PayTarget");
var v = new List<long>();
v.AddRange(payDetails.Select(x => x.StatPay_ID??0).Distinct());
v.AddRange(Dmo.Details.Select(x => x.StatPay_ID ?? 0).Distinct());
var payTarget = CheckPayTargetSame(v.Distinct());
Dmo.PayTarget = payTarget;
mDFContainer.ApplyToUIParitially("PayTarget");
if (Dmo.PayTarget != .)
return;
var ids = payDetails.Select(x => x.StatPay_ID).Where(x => x.HasValue);
@ -72,6 +75,18 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays
_farmerGrid.DataBind();
}
NamedValue<>? CheckPayTargetSame(IEnumerable<long> statpayIDs)
{
var query = new DQueryDom(new JoinAlias(typeof(StatPay)));
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), statpayIDs.Select(x => DQExpression.Value(x)).ToArray()));
query.Columns.Add(DQSelectColumn.Field("PayTarget"));
query.GroupBy.Expressions.Add(DQExpression.Field("PayTarget"));
var list = query.EExecuteList<NamedValue<>?>();
if (list.Count > 1)
throw new Exception("选择的结算单 付款对象必须一致");
return list.FirstOrDefault();
}
void AddFarmerDetails(IEnumerable<long?> statpayIDs)
{
var stat = new JoinAlias(typeof(StatPay));


+ 26
- 0
B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/SelectStatPayDialog_Ext.cs View File

@ -0,0 +1,26 @@
using BWP.B3ButcherManage.NamedValueTemplate;
using BWP.Web.Pages.B3ButcherManage.Bills.Pay_;
using BWP.Web.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays
{
class SelectStatPayDialog_Ext : SelectStatPayDialog
{
protected override void AddCustomerCondition(TSingSoft.WebControls2.TableLayoutPanel tablePanel, int left, int top)
{
tablePanel.Add(left, ++left, top, top + 1, new SimpleLabel("付款对象"));
tablePanel.Add(left, ++left, top, top + 1, mQueryContainer.Add(QueryCreator.DFNameValueInput<>(mDFInfo.Fields["PayTarget"]), "PayTarget"));
}
protected override void CreateQueryGridColumns(DFBrowseGrid grid)
{
base.CreateQueryGridColumns(grid);
grid.Columns.Add(new DFBrowseGridColumn("PayTarget"));
}
}
}

+ 1
- 0
B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayEdit_Ext.cs View File

@ -20,6 +20,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays
var tag = config.Items.FirstOrDefault(x => x.Key == "WeightSumRate");
if (tag != null)
tag.Key = "WeightSumRate2";
config.Add("PayTarget");
}
DFEditGrid _farmerGrid;


+ 13
- 0
B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayList_Ext.cs View File

@ -9,6 +9,19 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays
{
class StatPayList_Ext : StatPayList
{
protected override void AddCustomerCondition(Layout.LayoutManager panel, Layout.AutoLayoutConfig config)
{
base.AddCustomerCondition(panel, config);
config.Add("PayTarget");
}
protected override void AddDFBrowseGridColumn(DFBrowseGrid grid, string field)
{
base.AddDFBrowseGridColumn(grid, field);
if (field == "Supplier_Name")
AddDFBrowseGridColumn(grid, "PayTarget");
}
protected override void InitToolBar(TSingSoft.WebControls2.HLayoutPanel toolbar)
{
base.InitToolBar(toolbar);


+ 25
- 0
B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/WeighBillList_Ext.cs View File

@ -0,0 +1,25 @@
using BWP.Web.Layout;
using BWP.Web.Pages.B3ButcherManage.Bills.WeighBill_;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays
{
class WeighBillList_Ext : WeighBillList
{
protected override void AddCustomerCondition(LayoutManager panel, AutoLayoutConfig config)
{
base.AddCustomerCondition(panel, config);
config.Add("PayTarget");
}
protected override void AddDFBrowseGridColumn(TSingSoft.WebControls2.DFBrowseGrid grid, string field)
{
base.AddDFBrowseGridColumn(grid, field);
if (field == "Supplier_Name")
AddDFBrowseGridColumn(grid, "PayTarget");
}
}
}

+ 17
- 0
B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/WeightBillEdit_Ext.cs View File

@ -0,0 +1,17 @@
using BWP.Web.Pages.B3ButcherManage.Bills.WeighBill_;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays
{
class WeightBillEdit_Ext : WeighBillEdit
{
protected override void AddCustomerConfig(Layout.AutoLayoutConfig config)
{
base.AddCustomerConfig(config);
config.Add("PayTarget");
}
}
}

+ 1
- 28
B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/StatPayAnalyse.cs View File

@ -138,7 +138,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
mDisplayHelper.AddOptionItem("棚前头数", "_detail", "Number", false, true);
mDisplayHelper.AddOptionItem("棚前重量", "_detail", "ExeWeight", false, true);
mDisplayHelper.AddOptionItem("棚前金额", "_detail", "ExtMoney", false, true);
mDisplayHelper.AddOptionItem("付款对象", "_pay", "PayTarget", false);
mDisplayHelper.AddOptionItem("付款对象", "_bill", "PayTarget", false);
AddQueryOption("选项", mDisplayHelper.GetAllDisplayNames(), mDisplayHelper.GetDefaultSelelectedDisplayNames());
base.AddQueryOptions(vPanel);
@ -151,42 +151,15 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
var root = query.From.RootSource.Alias;
var weight = new JoinAlias("_weight", typeof(WeighBill));
var detail = new JoinAlias("_detail", typeof(Weigh_FarmerDetail));
var pay = new JoinAlias("_pay", typeof(PayTemp));
PayTemp.Register(query);
query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.EQ(root, "Weigh_ID", weight, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(root, "Weigh_ID", detail, "Weigh_ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(pay), DQCondition.EQ(pay, "StatPay_ID", root, "ID"));
mDisplayHelper.AddAlias("_bill", root);
mDisplayHelper.AddAlias("_weight", weight);
mDisplayHelper.AddAlias("_detail", detail);
mDisplayHelper.AddAlias("_pay", pay);
mDisplayHelper.AddSelectColumns(query, (name) => OptionIsSelected("选项", name), SumColumnNames, ColumnNames);
query.Where.Conditions.Add(DQCondition.EQ(root, "Domain_ID", DomainContext.Current.ID));
return query;
}
class PayTemp
{
public long StatPay_ID { get; set; }
public NamedValue<>? PayTarget { get; set; }
public static void Register(DQueryDom root)
{
var payDetail = new JoinAlias(typeof(Pay_Detail));
var pay = new JoinAlias("_pay", typeof(Pay));
var query = new DQueryDom(pay);
query.From.AddJoin(JoinType.Inner, new DQDmoSource(payDetail), DQCondition.EQ(payDetail, "Pay_ID", pay, "ID"));
query.Columns.Add(DQSelectColumn.Field("StatPay_ID", payDetail));
query.Columns.Add(DQSelectColumn.Field("PayTarget"));
query.GroupBy.Expressions.Add(DQExpression.Field(payDetail, "StatPay_ID"));
query.GroupBy.Expressions.Add(DQExpression.Field("PayTarget"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.GreaterThanOrEqual("BillState", .), DQCondition.EQ("Domain_ID", DomainContext.Current.ID)));
root.RegisterQueryTable(typeof(PayTemp), new string[] { "StatPay_ID", "PayTarget" }, query);
}
}
}
}

+ 4
- 0
B3QingDaoWanFu.Web/PluginClass.cs View File

@ -12,6 +12,7 @@ using BWP.Web.Pages.B3Sale.Bills.SaleOutStore_;
using TSingSoft.WebPluginFramework;
using TSingSoft.WebPluginFramework.Pages;
using TSingSoft.WebPluginFramework.TimerTasks;
using BWP.Web.Pages.B3ButcherManage.Bills.WeighBill_;
namespace BWP.B3QingDaoWanFu
{
@ -25,6 +26,9 @@ namespace BWP.B3QingDaoWanFu
WpfPageFactory.RegisterPageOverlay(typeof(StatPayList).FullName, typeof(StatPayList_Ext).FullName);
WpfPageFactory.RegisterPageOverlay(typeof(BWP.Web.Pages.B3ButcherManage.Bills.Pay_.PayEdit).FullName, typeof(PayEdit_Ext).FullName);
WpfPageFactory.RegisterPageOverlay(typeof(BWP.Web.Pages.B3ButcherManage.Reports.PayAnalyse).FullName, typeof(PayAnalyse_Ext).FullName);
WpfPageFactory.RegisterPageOverlay(typeof(WeighBillEdit).FullName, typeof(WeightBillEdit_Ext).FullName);
WpfPageFactory.RegisterPageOverlay(typeof(WeighBillList).FullName, typeof(WeighBillList_Ext).FullName);
WpfPageFactory.RegisterPageOverlay(typeof(BWP.Web.Pages.B3ButcherManage.Bills.Pay_.SelectStatPayDialog).FullName, typeof(SelectStatPayDialog_Ext).FullName);
GlobalFlags.On(B3ButcherManageConsts.GlobalFlags.StatPayAddRewardWithButcherUseWeight);
GlobalFlags.On(B3SaleConsts.Flags.MarketingActivityEnableAdjustPrice);
GlobalFlags.On(B3SaleConsts.Flags.SendOutStoreNoAvailableStorage);


+ 1
- 0
B3QingDaoWanFu/B3QingDaoWanFu.csproj View File

@ -175,6 +175,7 @@
<Compile Include="TypeIOCs\PayBLTypeIoc.cs" />
<Compile Include="TypeIOCs\SaleOutStoreBLTypeIoc.cs" />
<Compile Include="TypeIOCs\StatPayBLTypeIoc.cs" />
<Compile Include="TypeIOCs\WeightBillTypeIoc.cs" />
<Compile Include="Utils\B3QingDaoWanFuConsts.cs" />
<Compile Include="Utils\WanFuOnlineConfig.cs" />
</ItemGroup>


+ 2
- 0
B3QingDaoWanFu/TypeIOCs/PayBLTypeIoc.cs View File

@ -16,6 +16,8 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs
{
public void Invoke(IDmoContext context, Pay dmo)
{
if (dmo.PayTarget == null)
throw new Exception("付款对象不能为空");
if (dmo.PayTarget != .)
return;
var farmerMoney = dmo.FarmerDetails.Sum(x => x.Money.EToDecimal() ?? 0);


+ 47
- 33
B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs View File

@ -28,63 +28,48 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs
// }
//}
[TypeIOC(typeof(StatPayBL), typeof(StatPayBL.BaseBLIOCs.AfterInsert))]
public class StatPayAfterInsertBLTypeIoc : StatPayBL.BaseBLIOCs.AfterInsert
[TypeIOC(typeof(StatPayBL), typeof(StatPayBL.BaseBLIOCs.BeforeInsert))]
public class StatPayAfterInsertBLTypeIoc : StatPayBL.BaseBLIOCs.BeforeInsert
{
public void Invoke(IDmoContext context, StatPay dmo)
{
if (dmo.Weigh_ID == null)
return;
var details = GetFarmerDetail(context.Session, dmo.Weigh_ID.Value);
var total = details.Sum(x => x.Item2 ?? 0);
var details = GetFarmerDetails(dmo.Weigh_ID.Value);
foreach (var detail in details)
{
var arr = new List<Tuple<string, object>>();
if (total != 0)
if ((dmo.RealNumber ?? 0) != 0)
{
var v = dmo.RealWeight * detail.Item2 / total;
if (v.HasValue)
detail.ExeWeight = dmo.RealWeight * detail.Number / dmo.RealNumber;
var money = detail.Money;
if (dmo.PurchaseType_Name == "业务" && dmo.PayTarget == .)
{
v = decimal.Round(v.Value, 2);
arr.Add(new Tuple<string, object>("ExeWeight", v));
var extMoney = dmo.JingJianFee / dmo.RealNumber * detail.Number;
if (extMoney.HasValue)
extMoney = decimal.Round(extMoney.Value, 2);
money += (extMoney ?? 0);
}
detail.ExtMoney = money;
}
if (detail.Item3 != null)
{
arr.Add(new Tuple<string, object>("ExtMoney", detail.Item3));
}
if (arr.Any())
UpdateProperty(detail.Item1, context.Session, arr.ToArray());
dmo.FarmerDetails.Add(detail);
}
}
List<Tuple<long, int?, decimal?>> GetFarmerDetail(IDmoSession session, long weightID)
IEnumerable<Weigh_FarmerDetail> GetFarmerDetails(long weightID)
{
var query = new DQueryDom(new JoinAlias(typeof(Weigh_FarmerDetail)));
var query = new DmoQuery(typeof(Weigh_FarmerDetail));
query.Where.Conditions.Add(DQCondition.EQ("Weigh_ID", weightID));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Number"));
query.Columns.Add(DQSelectColumn.Field("Money"));
return query.EExecuteList<long, int?, decimal?>(session);
}
void UpdateProperty(long id, IDmoSession session, params Tuple<string, object>[] par)
{
var update = new DQUpdateDom(typeof(Weigh_FarmerDetail));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
foreach (var item in par)
update.Columns.Add(new DQUpdateColumn(item.Item1, item.Item2));
session.ExecuteNonQuery(update);
return query.EExecuteList().Cast<Weigh_FarmerDetail>();
}
}
[TypeIOC(typeof(StatPayBL), typeof(StatPayBL.BaseBLIOCs.AfterSave))]
public class StatPayAfterSaveBLTypeIoc : StatPayBL.BaseBLIOCs.AfterSave
{
public void Invoke(IDmoContext context, StatPay dmo)
{
CompareDetailMoney(dmo);
var ID = 36;
dmo.DeadPigRewardMoney = dmo.OtherRewardDetails.Where(x => x.Sanction_ID == ID).Sum(x => (x.Money ?? 0).Value);
var butcherdetail = dmo.Details.FirstOrDefault(x => x.HogGrade_ID.HasValue);
@ -110,6 +95,35 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs
if (dmo.ActualPrice.HasValue)
dmo.ActualPrice = decimal.Round(dmo.ActualPrice.Value.Value, 2);
}
if (dmo.ID == 0)
{
foreach (var item in dmo.FarmerDetails)
context.Session.Update(item);
dmo.FarmerDetails.Clear();
}
}
void CompareDetailMoney(StatPay dmo)
{
if (dmo.ID == 0)
return;
foreach (var detail in dmo.FarmerDetails)
{
if ((dmo.RealNumber ?? 0) != 0)
{
detail.ExeWeight = dmo.RealWeight * detail.Number / dmo.RealNumber;
var money = detail.Money;
if (dmo.PurchaseType_Name == "业务" && dmo.PayTarget == .)
{
var extMoney = dmo.JingJianFee / dmo.RealNumber * detail.Number;
if (extMoney.HasValue)
extMoney = decimal.Round(extMoney.Value, 2);
money += (extMoney ?? 0);
}
detail.ExtMoney = money;
}
}
}
}
}

+ 21
- 0
B3QingDaoWanFu/TypeIOCs/WeightBillTypeIoc.cs View File

@ -0,0 +1,21 @@
using BWP.B3ButcherManage.BL;
using BWP.B3ButcherManage.BO;
using BWP.B3Frameworks;
using Forks.EnterpriseServices.BusinessInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.B3QingDaoWanFu.TypeIOCs
{
[TypeIOC(typeof(WeightBillBL), typeof(WeightBillBL.BillBLIOCs.BeforeCheck))]
public class WeightBillBeforeCheck : WeightBillBL.BillBLIOCs.BeforeCheck
{
public void Invoke(IDmoContext context, WeighBill dmo)
{
if (dmo.PayTarget == null)
throw new Exception("付款对象不能为空");
}
}
}

Loading…
Cancel
Save