Browse Source

需求单No.139862:大红门【结算单导Nc凭证】。

master
gww 7 years ago
parent
commit
d8af2c0ed8
8 changed files with 408 additions and 0 deletions
  1. +6
    -0
      BWP.B3ButcherManageExport.Web/BWP.B3ButcherManageExport.Web.csproj
  2. +169
    -0
      BWP.B3ButcherManageExport.Web/Pages/B3ButcherManageExport/NC_/StatPayToNc_/StatPayToNcList.cs
  3. +75
    -0
      BWP.B3ButcherManageExport.Web/Pages/B3ButcherManageExport/NC_/StatPayToNc_/StatPayToNcList.xml
  4. +1
    -0
      BWP.B3ButcherManageExport/B3ButcherManageExportConsts.cs
  5. +61
    -0
      BWP.B3ButcherManageExport/BL/NC/StatPayToNcBL_/StatPayToNcBL.cs
  6. +93
    -0
      BWP.B3ButcherManageExport/BL/NC/script/大红门结算单导NC凭证.py
  7. +2
    -0
      BWP.B3ButcherManageExport/BWP.B3ButcherManageExport.csproj
  8. +1
    -0
      WebFolder/Config/Plugins/B3ButcherManageExport.Plugin

+ 6
- 0
BWP.B3ButcherManageExport.Web/BWP.B3ButcherManageExport.Web.csproj View File

@ -86,6 +86,9 @@
<Compile Include="Pages\B3ButcherManageExport\NC_\PayToNc_\PayToNcList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ButcherManageExport\NC_\StatPayToNc_\StatPayToNcList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ButcherManageExport\U8\PayToU8_\PayToU8List.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@ -142,6 +145,9 @@
<ItemGroup>
<EmbeddedResource Include="Pages\B3ButcherManageExport\U8\ProductInStoreToU8_\ProductInStoreToU8List.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3ButcherManageExport\NC_\StatPayToNc_\StatPayToNcList.xml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.


+ 169
- 0
BWP.B3ButcherManageExport.Web/Pages/B3ButcherManageExport/NC_/StatPayToNc_/StatPayToNcList.cs View File

@ -0,0 +1,169 @@
using BWP.B3ButcherManage.BO;
using BWP.B3ButcherManageExport.BL;
using BWP.B3ExportBase;
using BWP.B3ExportBase.Utils;
using BWP.B3Frameworks;
using BWP.B3Frameworks.BO.MoneyTemplate;
using BWP.B3Frameworks.BO.NamedValueTemplate;
using BWP.Web.Pages.B3ExportBase;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.SqlDoms;
using Forks.Utils;
using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3ButcherManageExport.NC_.StatPayToNc_
{
public class StatPayToNcList : ExportBaseList<StatPay, IStatPayToNcBL>
{
protected override string DoExport(List<long> idList)
{
if (idList.Count == 0)
{
throw new ApplicationException("请选择单据!");
}
if (_dfcUrl.IsEmpty)
{
throw new ApplicationException("请选择外部系统!");
}
BL.Export(idList, long.Parse(_dfcUrl.Value), _billDate.Value);
return BIFactory.GetLastMessage();
}
private ChoiceBox _dfcUrl;
private DFDateInput _billDate;
protected override void AddExportControl(HLayoutPanel hbox)
{
hbox.Add(new SimpleLabel("外部系统"));
_dfcUrl = hbox.Add(new ChoiceBox());
_dfcUrl.DataKind = B3ExportBaseConsts.DataSources.;
_dfcUrl.EnableInputArgument = true;
_dfcUrl.SmartOrderEnabled = false;
_dfcUrl.EnableTopItem = true;
_dfcUrl.Width = 130;
hbox.Add(new SimpleLabel("日期"));
_billDate = hbox.Add(new DFDateInput());
_billDate.Value = DateTime.Today;
base.AddExportControl(hbox);
}
private DropDownList payStateSelect;
protected override void AddQueryControls(VLayoutPanel vPanel)
{
vPanel.Add(CreateDefaultBillQueryControls((panel, config) =>
{
panel.Add("Weigh_ID", new DFTextBox(mDFInfo.Fields["Weigh_ID"]));
panel.Add("PayState", new SimpleLabel("付款状态"), payStateSelect = new DropDownList());
panel["PayState"].NotAutoAddToContainer = true;
payStateSelect.Items.Add("");
payStateSelect.Items.Add("已付款");
payStateSelect.Items.Add("未付款");
payStateSelect.Items.Add("部分付款");
config.Add("Date");
config.Add("AccountingUnit_ID");
config.Add("Department_ID");
config.Add("Employee_ID");
config.Add("Supplier_ID");
config.Add("Weigh_ID");
config.Add("PayState");
}));
}
protected override void AddDFBrowseGridColumn(DFBrowseGrid grid, string field)
{
base.AddDFBrowseGridColumn(grid, field);
if (field == "BillState")
{
AddDFBrowseGridColumn(grid, "Weigh_ID");
AddDFBrowseGridColumn(grid, "AccountingUnit_Name");
AddDFBrowseGridColumn(grid, "Department_Name");
AddDFBrowseGridColumn(grid, "Supplier_Name");
AddDFBrowseGridColumn(grid, "Employee_Name");
AddDFBrowseGridColumn(grid, "CheckUser_Name");
AddDFBrowseGridColumn(grid, "Remark");
}
}
protected override DQueryDom GetQueryDom()
{
var dom = base.GetQueryDom();
dom.EAddCheckedCondition(dom.From.RootSource.Alias);
if (payStateSelect.SelectedIndex != 0)
{
PayTemp.Register(dom);
var temp = new JoinAlias(typeof(PayTemp));
dom.From.AddJoin(JoinType.Left, new DQDmoSource(temp), DQCondition.EQ(dom.From.RootSource.Alias, "ID", temp, "StatPayID"));
switch (payStateSelect.SelectedIndex)
{
case 1:
dom.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(DQExpression.Field(temp, "Money"), DQExpression.Field("ActualMoney")));
break;
case 2:
dom.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field(temp, "StatPayID")));
break;
default:
dom.Where.Conditions.Add(DQCondition.LessThan(DQExpression.Field(temp, "Money"), DQExpression.Field("ActualMoney")));
break;
}
}
return dom;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
var tuple = ExportConfigUtil.LoadDefaultExtSystems(MethodID);
if (tuple != null)
{
_dfcUrl.Value = tuple.Item1.ToString();
_dfcUrl.DisplayValue = tuple.Item2;
}
}
}
public override string Url
{
get { return "~/B3ButcherManageExport/NC_/StatPayToNc_/StatPayToNcList.aspx"; }
}
protected override string EditUrl
{
get
{
return "B3ButcherManage/Bills/StatPay_/StatPayEdit.aspx";
}
}
protected override string Caption
{
get { return "结算单导NC凭证"; }
}
}
class PayTemp
{
public long StatPayID { get; set; }
public Money<>? Money { get; set; }
public static void Register(DQueryDom root)
{
var main = new JoinAlias(typeof(Pay));
var detail = new JoinAlias(typeof(Pay_Detail));
var query = new DQueryDom(detail);
query.From.AddJoin(JoinType.Left, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "Pay_ID"));
query.Columns.Add(DQSelectColumn.Field("StatPay_ID"));
query.Columns.Add(DQSelectColumn.Sum("Money"));
query.GroupBy.Expressions.Add(DQExpression.Field("StatPay_ID"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.GreaterThanOrEqual(main, "BillState", .), DQCondition.EQ(main, "Domain_ID", DomainContext.Current.ID)));
root.RegisterQueryTable(typeof(PayTemp), new string[] { "StatPayID", "Money" }, query);
}
}
}

+ 75
- 0
BWP.B3ButcherManageExport.Web/Pages/B3ButcherManageExport/NC_/StatPayToNc_/StatPayToNcList.xml View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
<Field name="ID"/>
</Columns>
<From>
<DmoClass class="BWP.B3ButcherManage.BO.StatPay, B3ButcherManage"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<EQ>
<Field name="Supplier_ID"/>
<QBE paramName="Supplier_ID"/>
</EQ>
<EQ>
<Field name="AccountingUnit_ID"/>
<QBE paramName="AccountingUnit_ID"/>
</EQ>
<EQ>
<Field name="Department_ID"/>
<QBE paramName="Department_ID"/>
</EQ>
<EQ>
<Field name="Employee_ID"/>
<QBE paramName="Employee_ID"/>
</EQ>
<EQ>
<Field name="Weigh_ID"/>
<QBE paramName="Weigh_ID"/>
</EQ>
<EQ>
<Field name="IsLocked"/>
<QBE paramName="IsLocked"/>
</EQ>
<Contains>
<Field name="Remark"/>
<QBE paramName="Remark"/>
</Contains>
<Contains>
<Field name="CreateUser_Name"/>
<QBE paramName="CreateUser_Name"/>
</Contains>
<Contains>
<Field name="CheckUser_Name"/>
<QBE paramName="CheckUser_Name"/>
</Contains>
<GreaterThanOrEqual>
<Field name="CreateTime"/>
<QBE paramName="MinCreateTime" />
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="CreateTime"/>
<QBE paramName="MaxCreateTime"/>
</LessThanOrEqual>
<GreaterThanOrEqual>
<Field name="Date"/>
<QBE paramName="MinDate" />
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="Date"/>
<QBE paramName="MaxDate"/>
</LessThanOrEqual>
<EQ>
<Field name="BillState"/>
<QBE paramName ="BillState"/>
</EQ>
</And>
</Where>
</Select>

+ 1
- 0
BWP.B3ButcherManageExport/B3ButcherManageExportConsts.cs View File

@ -12,6 +12,7 @@ namespace BWP.B3ButcherManageExport {
public const byte StatPayToU8 = 5;
public const byte PayToU8 = 6;
public const byte ProductInStoreToU8 = 7;
public const byte StatPayToNc = 8;
}
public class DmoTypeID {


+ 61
- 0
BWP.B3ButcherManageExport/BL/NC/StatPayToNcBL_/StatPayToNcBL.cs View File

@ -0,0 +1,61 @@
using BWP.B3ButcherManage.BO;
using BWP.B3ExportBase;
using BWP.B3ExportBase.BL;
using BWP.B3ExportBase.BO;
using BWP.B3Frameworks;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.BusinessInterfaces;
using System;
using System.Collections.Generic;
using TSingSoft.WebPluginFramework;
using TSingSoft.WebPluginFramework.BIPlugins.BLEvents;
namespace BWP.B3ButcherManageExport.BL
{
[BusinessInterface(typeof(StatPayToNcBL))]
public interface IStatPayToNcBL : INcBL<StatPay>
{
void Export(List<long> idList, long p, DateTime? nullable);
}
[LogicName("结算单导NC凭证")]
[BindToFeature("B3ButcherManageExport.0008")]
[ExportID(B3FrameworksConsts.DmoTypeIDBases.B3ButcherManageExport, B3ButcherManageExportConsts.ExportIDOffsets.StatPayToNc)]
public class StatPayToNcBL : NcBL<StatPay>, IStatPayToNcBL
{
public readonly List<string> MinPreDetailProperties = new List<string>();
protected override NcUfinterface CreateUfinterface(IList<StatPay> dmos)
{
var scriptHelper = new PythonScriptHelper(string.Empty, Config.Script, this);
scriptHelper.AddLocalVar("dmos", dmos);
if (Version == "6.3")
{
{
var bills = BO.NcVouchers.New();
scriptHelper.AddLocalVar("vouchers", bills);
scriptHelper.Execute();
var i = 0;
foreach (var bill in bills.Bills)
{
BillIDs.Add(i, bill.B2BillIDs);
i++;
}
return bills;
}
}
throw new Exception("未实现导出方法");
}
public override short GetMethodID()
{
return B3FrameworksConsts.DmoTypeIDBases.B3ButcherManageExport + B3ButcherManageExportConsts.ExportIDOffsets.StatPayToNc;
}
public DateTime Date { get; set; }
public void Export(List<long> dmoIDs, long extSystemID, DateTime? date)
{
Date = date ?? BLContext.Today;
Export(dmoIDs, extSystemID);
}
}
}

+ 93
- 0
BWP.B3ButcherManageExport/BL/NC/script/大红门结算单导NC凭证.py View File

@ -0,0 +1,93 @@
from BWP.B3ButcherManageExport.BO import NcVoucher;
from BWP.B3ButcherManageExport.BO import NcVoucherEntry;
from BWP.B3ButcherManageExport.BO import Items;
from BWP.B3ButcherManageExport.BO import Otheruserdata;
from System import Convert;
class BLMethodEvents(BLMethodEventsBase):
def before(self):
self.proxy.MinDmoProperties.Add("Date");
self.proxy.MinDmoProperties.Add("Supplier_Name");
self.proxy.MinDmoProperties.Add("AccountingUnit_ID");
self.proxy.MinDmoProperties.Add("AccountingUnit_Name");
self.proxy.MinDmoProperties.Add("Employee_Name");
self.proxy.MinDmoProperties.Add("RealNumber");#收购头数
self.proxy.MinDmoProperties.Add("RealWeight");#收购重量
self.proxy.MinDmoProperties.Add("RawPrice");#毛重单价
self.proxy.MinDmoProperties.Add("Money");#应付金额
self.proxy.MinDmoProperties.Add("ActualMoney");#实付金额
def execute(self):
self.proxy.CheckAccountingUnit(dmos);
voucher2 = NcVoucher();
for dmo in dmos:
voucher2.B2BillIDs.Add(dmo.ID);
voucher2.Head.Company = dmo.AccountingUnit_Name;
if dmo.AccountingUnit_ID==5:
voucher2.Head.VoucherType = "QHC凭证";
else:
voucher2.Head.VoucherType = "记账凭证";
voucher2.Head.FiscalYear = self.proxy.GetDateTime(gToday,"yyyy");
voucher2.Head.AccountingPeriod = self.proxy.GetDateTime(gToday,"MM");
voucher2.Head.Date = self.proxy.GetDateTime(gToday,"yyyy-MM-dd");
voucher2.Head.Signature = "Y";
voucher2.Head.VoucherMakingSystem = "总账";
voucher2.Head.Reserve2 = "N";
voucher2.Head.Enter = gUser.Name;
voucher2.Head.VoucherId = "0";
voucher2.Head.AttachmentNumber = "0";
vouchers.Bills.Add(voucher2);
entryid = 0;
num = str(dmo.RealNumber);
weight = str(dmo.RealWeight);
abstract = self.proxy.GetDateTime(dmo.Date,"yyyy-MM-dd")+dmo.Supplier_Name +"购买生猪"+ num + ""+ weight +"KG";
for dmo in dmos:
if dmo.AccountingUnit_ID == 1:
entryid = entryid + 1;
entry = NcVoucherEntry();
voucher2.Body.Entrys.Add(entry);
entry.EntryId = str(entryid);
entry.AccountCode = "原材料\生猪" ;
entry.Abstract = abstract;
entry.Currency = "CNY";
entry.ExchangeRate2 = "1" ;
entry.PrimaryDebitAmount = str(dmo.Money);
entry.NaturalDebitCurrency = str(dmo.Money);
entry.DebitQuantity = weight;
entry.UnitPrice = str(dmo.RawPrice);
for dmo in dmos:
if dmo.AccountingUnit_ID == 1:
entryid = entryid + 1;
entry = NcVoucherEntry();
voucher2.Body.Entrys.Add(entry);
entry.EntryId = str(entryid);
entry.AccountCode = "预付账款\集团外预付账款\其他预付生猪款" ;
entry.Abstract = abstract;
entry.Currency = "CNY";
entry.ExchangeRate2 = "1" ;
entry.PrimaryCreditAmount = str(dmo.Money);
entry.NaturalCreditCurrency = str(dmo.Money);
item =Items();
item.Name = "供应商辅助核算";
item.Value = dmo.Supplier_Name;
entry.Accountings.Items.Add(item);
for dmo in dmos:
if dmo.AccountingUnit_ID == 1:
entryid = entryid + 1;
entry = NcVoucherEntry();
voucher2.Body.Entrys.Add(entry);
entry.EntryId = str(entryid);
entry.AccountCode = "应付账款\集团外应付账款\应付生猪款";
entry.Abstract = abstract;
entry.Currency = "CNY";
entry.ExchangeRate2 = "1" ;
entry.PrimaryCreditAmount = str(dmo.ActualMoney);
entry.NaturalCreditCurrency = str(dmo.ActualMoney);
item =Items();
item.Name = "供应商辅助核算";
item.Value = dmo.Supplier_Name;
entry.Accountings.Items.Add(item);

+ 2
- 0
BWP.B3ButcherManageExport/BWP.B3ButcherManageExport.csproj View File

@ -76,6 +76,7 @@
<Compile Include="BL\EAS\StatPayToEasVoucherBL.cs" />
<Compile Include="BL\NC\AdvancePayToNcBL_\AdvancePayToNcBL.cs" />
<Compile Include="BL\NC\PayToNcBL_\PayToNcBL.cs" />
<Compile Include="BL\NC\StatPayToNcBL_\StatPayToNcBL.cs" />
<Compile Include="BL\U8\PayToU8BL_\PayToU8BL.cs" />
<Compile Include="BL\U8\ProductInStoreU8BL_\ProductInStoreToU8BL.cs" />
<Compile Include="BL\U8\StatPayToU8BL_\StatPayToU8BL.cs" />
@ -101,6 +102,7 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="BL\NC\script\大红门结算单导NC凭证.py" />
<None Include="BL\NC\script\大红门付款单导NC凭证.py" />
<None Include="BL\U8\script\屠宰场成品入库导U8产成品入库.py" />
<None Include="BL\U8\script\屠宰场付款单导U8付款单.py" />


+ 1
- 0
WebFolder/Config/Plugins/B3ButcherManageExport.Plugin View File

@ -23,6 +23,7 @@
<Feature id="0005" name="B3结算单导U8采购入库单"/>
<Feature id="0006" name="B3付款单导U8付款单"/>
<Feature id="0007" name="B3屠宰成品入库导U8产成品入库单"/>
<Feature id="0008" name="B3结算单导NC凭证"/>
</Features>
</Plugin>

Loading…
Cancel
Save