Browse Source

增加销售出库单 接口

master
robin 7 years ago
parent
commit
ab6587bb3c
9 changed files with 439 additions and 3 deletions
  1. +12
    -1
      B3_QiLianMuGe.Web/B3_QiLianMuGe.Web.csproj
  2. +28
    -0
      B3_QiLianMuGe.Web/Pages/B3_QiLianMuGe/Test.cs
  3. +140
    -0
      B3_QiLianMuGe.Web/Pages/B3_QiLianMuGe/ToK3Cloud/SaleOutStoreToK3CloudList.cs
  4. +81
    -0
      B3_QiLianMuGe.Web/Pages/B3_QiLianMuGe/ToK3Cloud/SaleOutStoreToK3CloudList.xml
  5. +10
    -0
      B3_QiLianMuGe/B3QiLianMuGeConsts.cs
  6. +9
    -1
      B3_QiLianMuGe/B3_QiLianMuGe.csproj
  7. +72
    -0
      B3_QiLianMuGe/BL/SaleOutStoreToK3CloudBL.cs
  8. +85
    -0
      B3_QiLianMuGe/BL/script/销售出库单导金蝶云凭证.py
  9. +2
    -1
      WebFolder/config/plugins/B3_QiLianMuGe.plugin

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

@ -36,6 +36,11 @@
<HintPath>..\..\..\tsref\Debug\B3ButcherManage.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="B3ExportBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL" />
<Reference Include="B3ExportBase.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\B3ExportBase.Web.dll</HintPath>
</Reference>
<Reference Include="B3Frameworks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\BwpB3Project\tsref\Debug\B3Frameworks.dll</HintPath>
@ -128,11 +133,17 @@
<Compile Include="..\..\..\version\Customer_version.cs">
<Link>Customer_version.cs</Link>
</Compile>
<Compile Include="Pages\B3_QiLianMuGe\Test.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3_QiLianMuGe\ToK3Cloud\SaleOutStoreToK3CloudList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="PluginClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Pages\B3_QiLianMuGe\" />
<EmbeddedResource Include="Pages\B3_QiLianMuGe\ToK3Cloud\SaleOutStoreToK3CloudList.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\B3_QiLianMuGe\B3_QiLianMuGe.csproj">


+ 28
- 0
B3_QiLianMuGe.Web/Pages/B3_QiLianMuGe/Test.cs View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3_QiLianMuGe {
class Test : AppBasePage {
protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form) {
form.Controls.Add(new LiteralControl("<h1>测试</h1>"));
var vPanel = new VLayoutPanel();
form.Controls.Add(vPanel);
var text = vPanel.Add(new DFTextBox());
text.TextMode = TextBoxMode.MultiLine;
text.Width = 300;
text.Height = 150;
var submit = vPanel.Add(new TSButton());
submit.Text = "测试";
submit.Click += delegate {
// K3CloudHelper.Login();
};
}
}
}

+ 140
- 0
B3_QiLianMuGe.Web/Pages/B3_QiLianMuGe/ToK3Cloud/SaleOutStoreToK3CloudList.cs View File

@ -0,0 +1,140 @@
using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using B3_QiLianMuGe.BL;
using BWP.B3ExportBase;
using BWP.B3ExportBase.Utils;
using BWP.B3Frameworks;
using BWP.B3Frameworks.BO.NamedValueTemplate;
using BWP.B3Sale.BO;
using BWP.B3Sale.Utils;
using BWP.Web.Pages.B3ExportBase;
using BWP.Web.Utils;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.SqlDoms;
using Forks.Utils.Collections;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3_QiLianMuGe.ToK3Cloud
{
public class SaleOutStoreToK3CloudList : ExportBaseList<SaleOutStore, ISaleOutStoreToK3CloudBL> {
protected override string Caption {
get { return "销售出库单导金蝶云凭证"; }
}
public override string Url {
get { return "~/B3_QiLianMuGe/ToK3Cloud/SaleOutStoreToK3CloudList.aspx"; }
}
protected override string EditUrl {
get {
return "B3Sale/Bills/SaleOutStore_/SaleOutStoreEdit.aspx";
}
}
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) );
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 ChoiceBox _deliverGoodsLineID;
protected override void AddQueryControls(VLayoutPanel vPanel) {
vPanel.Add(CreateDefaultBillQueryControls((panel, config) => {
DFNamedValueInput<> billStateInput;
panel.Add("BillState", billStateInput = QueryCreator.(mDFInfo.Fields["BillState"]));
billStateInput.Value = .;
panel.Add("OrderDate", QueryCreator.DateRange(mDFInfo.Fields["OrderDate"], mQueryContainer, "MinOrderDate", "MaxOrderDate"));
panel.Add("LoadTime", QueryCreator.DateRange(mDFInfo.Fields["LoadTime"], mQueryContainer, "MinLoadTime", "MaxLoadTime"));
panel.Add("ArriveTime", QueryCreator.DateRange(mDFInfo.Fields["ArriveTime"], mQueryContainer, "MinArriveTime", "MaxArriveTime"));
panel.Add("Customer_ID", QueryCreator.DFChoiceBox(mDFInfo.Fields["Customer_ID"], B3SaleDataSources.));
panel.Add("AccountingUnit_ID", QueryCreator.DFChoiceBox(mDFInfo.Fields["AccountingUnit_ID"], B3FrameworksConsts.DataSources.));
panel.Add("Department_ID", QueryCreator.DFChoiceBox(mDFInfo.Fields["Department_ID"], B3FrameworksConsts.DataSources.));
panel.Add("Employee_ID", QueryCreator.DFChoiceBox(mDFInfo.Fields["Employee_ID"], B3FrameworksConsts.DataSources.));
panel.Add("Store_ID", QueryCreator.DFChoiceBox(mDFInfo.Fields["Store_ID"], B3FrameworksConsts.DataSources.));
panel.Add("DeliverGoodsLine_ID", new SimpleLabel("送货线路排序"), _deliverGoodsLineID = new ChoiceBox() { DataKind = B3SaleDataSources.线, Width = Unit.Empty, EnableTopItem = true, EnableInputArgument = true });
panel["DeliverGoodsLine_ID"].NotAutoAddToContainer = true;
config.Add("OrderDate");
config.Add("LoadTime");
config.Add("ArriveTime");
config.Add("Customer_ID");
config.Add("AccountingUnit_ID");
config.Add("Department_ID");
config.Add("Employee_ID");
config.Add("Store_ID");
config.Add("DeliverGoodsLine_ID");
config.Add("BillState");
}));
}
protected override void AddDFBrowseGridColumn(DFBrowseGrid grid, string field) {
base.AddDFBrowseGridColumn(grid, field);
if (field == "BillState") {
AddDFBrowseGridColumn(grid, "Customer_Name");
AddDFBrowseGridColumn(grid, "AccountingUnit_Name");
AddDFBrowseGridColumn(grid, "Store_Name");
AddDFBrowseGridColumn(grid, "Department_Name");
AddDFBrowseGridColumn(grid, "Employee_Name");
AddDFBrowseGridColumn(grid, "OrderDate");
AddDFBrowseGridColumn(grid, "LoadTime");
AddDFBrowseGridColumn(grid, "ArriveTime");
AddDFBrowseGridColumn(grid, "AllUnitNum");
mBrowseGrid.Columns.EAdd(new DFBrowseGridColumn("Money")).SumMode = SumMode.Sum;
AddDFBrowseGridColumn(grid, "DeliverGoodsLine_Name");
}
}
protected override DQueryDom GetQueryDom() {
var dom = base.GetQueryDom();
if (!string.IsNullOrEmpty(_deliverGoodsLineID.Value)) {
dom.OrderBy.Expressions.Clear();
var deliverGoodsLineDetail = new JoinAlias(typeof(DeliverGoodsLine_Detail));
dom.From.AddJoin(JoinType.Right, new DQDmoSource(deliverGoodsLineDetail),
DQCondition.And(
DQCondition.EQ(dom.From.RootSource.Alias, "Customer_ID", deliverGoodsLineDetail, "Customer_ID"),
DQCondition.EQ(deliverGoodsLineDetail, "DeliverGoodsLine_ID", _deliverGoodsLineID.Value)));
dom.OrderBy.Expressions.Add(DQOrderByExpression.Create(deliverGoodsLineDetail, "SequenceNumber", false));
}
dom.EAddCheckedCondition(dom.From.RootSource.Alias);
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;
}
}
}
}
}

+ 81
- 0
B3_QiLianMuGe.Web/Pages/B3_QiLianMuGe/ToK3Cloud/SaleOutStoreToK3CloudList.xml View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
<Field name="ID"/>
</Columns>
<From>
<DmoClass class="BWP.B3Sale.BO.SaleOutStore, B3Sale"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<EQ>
<Field name="Customer_ID"/>
<QBE paramName="Customer_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="Store_ID"/>
<QBE paramName="Store_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="OrderDate"/>
<QBE paramName="MinOrderDate" />
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="OrderDate"/>
<QBE paramName="MaxOrderDate"/>
</LessThanOrEqual>
<GreaterThanOrEqual>
<Field name="LoadTime"/>
<QBE paramName="MinLoadTime" />
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="LoadTime"/>
<QBE paramName="MaxLoadTime"/>
</LessThanOrEqual>
<GreaterThanOrEqual>
<Field name="CreateTime"/>
<QBE paramName="MinCreateTime" />
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="CreateTime"/>
<QBE paramName="MaxCreateTime"/>
</LessThanOrEqual>
<EQ>
<Field name="BillState"/>
<QBE paramName ="BillState"/>
</EQ>
</And>
</Where>
</Select>

+ 10
- 0
B3_QiLianMuGe/B3QiLianMuGeConsts.cs View File

@ -0,0 +1,10 @@
namespace B3_QiLianMuGe
{
public class B3QiLianMuGeConsts {
public static class ExportIDOffsets
{
public const byte SaleOutStoreToK3Cloud = 1;
}
}
}

+ 9
- 1
B3_QiLianMuGe/B3_QiLianMuGe.csproj View File

@ -36,6 +36,10 @@
<HintPath>..\..\..\tsref\Debug\B3ButcherManage.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="B3ExportBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\B3ExportBase.dll</HintPath>
</Reference>
<Reference Include="B3Frameworks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\BwpB3Project\tsref\Debug\B3Frameworks.dll</HintPath>
@ -125,13 +129,17 @@
<Compile Include="..\..\..\version\Customer_version.cs">
<Link>Customer_version.cs</Link>
</Compile>
<Compile Include="BL\SaleOutStoreToK3CloudBL.cs" />
<Compile Include="B3QiLianMuGeConsts.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="BL\" />
<Folder Include="BO\" />
<Folder Include="Utils\" />
</ItemGroup>
<ItemGroup>
<None Include="BL\script\销售出库单导金蝶云凭证.py" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\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.


+ 72
- 0
B3_QiLianMuGe/BL/SaleOutStoreToK3CloudBL.cs View File

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BWP.B3ExportBase;
using BWP.B3ExportBase.BL;
using BWP.B3ExportBase.BL.K3Cloud;
using BWP.B3Frameworks;
using BWP.B3Sale.BO;
using BWP.B3UnitedInfos.BO;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using TSingSoft.WebPluginFramework;
namespace B3_QiLianMuGe.BL
{
[BusinessInterface(typeof(SaleOutStoreToK3CloudBL))]
public interface ISaleOutStoreToK3CloudBL : IK3CloudVoucherBL<SaleOutStore> {
}
[LogicName("销售出库单导金蝶云凭证")]
[ExportID(B3FrameworksConsts.DmoTypeIDBases.B3_QiLianMuGe, B3QiLianMuGeConsts.ExportIDOffsets.SaleOutStoreToK3Cloud)]
public class SaleOutStoreToK3CloudBL : K3CloudVoucherBL<SaleOutStore>, ISaleOutStoreToK3CloudBL {
public override short GetMethodID() {
return B3FrameworksConsts.DmoTypeIDBases.B3_QiLianMuGe + B3QiLianMuGeConsts.ExportIDOffsets.SaleOutStoreToK3Cloud;
}
protected override Action<List<SaleOutStore>> FillDetail {
get {
return dmos => {
var dmoType = typeof(SaleOutStore_Detail);
var dom = new DQueryDom(new JoinAlias(dmoType));
dom.Columns.Add(DQSelectColumn.Field("ID"));
foreach (string property in MinDetailProperties) {
dom.Columns.Add(DQSelectColumn.Field(property));
}
var expressionList = new List<IDQExpression>();
foreach (var dmo in dmos)
expressionList.Add(DQExpression.Value(dmo.ID));
dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("SaleOutStore_ID"),
expressionList.ToArray()));
var details = new List<SaleOutStore_Detail>();
details.Clear();
using (IDQDataReader reader = Session.ExecuteReader(dom)) {
while (reader.Read()) {
var detail = new SaleOutStore_Detail {
ID = (long)reader[0]
};
int i = 1;
foreach (var property in MinDetailProperties) {
dmoType.GetProperty(property).SetValue(detail, reader[i++], null);
}
details.Add(detail);
}
}
var groups = details.GroupBy(x => x.SaleOutStore_ID);
foreach (var gDetail in groups) {
var firstDmo = dmos.FirstOrDefault(x => x.ID == gDetail.Key);
if (firstDmo == null)
continue;
foreach (var billDetail in gDetail.OrderBy(x => x.ID)) {
firstDmo.Details.Add(billDetail);
}
}
};
}
}
}
}

+ 85
- 0
B3_QiLianMuGe/BL/script/销售出库单导金蝶云凭证.py View File

@ -0,0 +1,85 @@
from BWP.B3ExportBase.BL.K3Cloud import Voucher ,VoucherEntity,FDetailid
from System.Collections.Generic import List ,Dictionary
from System import Int64 ,Object ,Convert
from BWP.B3ExportBase import B3ExportBaseConsts;
class BLMethodEvents(BLMethodEventsBase):
def before(self):
self.proxy.LoadFullDom = 0
self.proxy.MinDmoProperties.Add("ID");
self.proxy.MinDmoProperties.Add("Customer_ID");
self.proxy.MinDmoProperties.Add("Customer_Name");
self.proxy.MinDmoProperties.Add("Money");
self.proxy.MinDmoProperties.Add("CheckTime");
self.proxy.MinDetailProperties.Add("SaleOutStore_ID");
self.proxy.MinDetailProperties.Add("SaleGoods_ID");
self.proxy.MinDetailProperties.Add("UnitNum");#报价数量
self.proxy.MinDetailProperties.Add("Price");#单价
self.proxy.MinDetailProperties.Add("RebateMoney"); #不含税金额
self.proxy.MinDetailProperties.Add("Money"); #金额
def execute(self):
cusDmoType = B3ExportBaseConsts.DmoTypeID.;
goodsDmoType = B3ExportBaseConsts.DmoTypeID.;
i = 0
for dmo in dmos:
ids = List[Int64]();
ids.Add(dmo.ID)
idsDic.Add(i,ids)
i = i + 1
voucher = Voucher()
voucherContainer.Model.Add(voucher);
voucher.FAccountBookID.Add("FNumber", "001"); #账簿
voucher.FVOUCHERGROUPID.Add("FNumber", "PRE001"); #凭证字
voucher.FVOUCHERGROUPNO = "1"; #凭证号 默认
voucher.FDocumentStatus = "Z";
voucher.FYEAR = gToday.Year; #会计年度
voucher.FPERIOD = gToday.Month; #期间
#借方--------------------------------------------------------
entry = VoucherEntity();
entry.FEXPLANATION = "" + dmo.Customer_Name + "货款 " + self.proxy.GetDateTime(dmo.CheckTime,"yyyy-MM-dd");
entry.FACCOUNTID.Add("FNumber", "1122.01"); #会计科目
entry.FCURRENCYID.Add("FNumber", "PRE001"); #币别
entry.FEXCHANGERATETYPE.Add("FNumber", "HLTX01_SYS");#汇率类型
entry.FEXCHANGERATE = 1.0; #汇率
entry.FAMOUNTFOR = Convert.ToDecimal(dmo.Money) #原币金额
entry.FDEBIT = Convert.ToDecimal(dmo.Money) #借方金额
entry.FDetailID = FDetailid(); #核算维度
cusNo = self.proxy.GetExtFieldByName(dmo.Customer_ID,cusDmoType ,"ExternalField1");
entry.FDetailID.FDETAILID__FFLEX6 = Dictionary[str,Object]();
entry.FDetailID.FDETAILID__FFLEX6.Add("FNumber", cusNo);
voucher.FEntity.Add(entry);
#贷方------------------------------------------------------------
for detail in dmo.Details:
entry2 = VoucherEntity();
entry2.FEXPLANATION = "" + dmo.Customer_Name + "货款 " + self.proxy.GetDateTime(dmo.CheckTime,"yyyy-MM-dd")
entry2.FACCOUNTID.Add("FNumber", "6001.01");
entry2.FCURRENCYID.Add("FNumber", "PRE001");
entry2.FEXCHANGERATETYPE.Add("FNumber", "HLTX01_SYS");
entry2.FEXCHANGERATE = 1.0;
entry2.FAMOUNTFOR = Convert.ToDecimal(detail.RebateMoney)
entry2.FCREDIT = Convert.ToDecimal(detail.RebateMoney)
entry2.FPrice = Convert.ToDecimal(detail.Price)
entry2.FQty = Convert.ToDecimal( detail.UnitNum)
entry2.FUnitId.Add("FNUMBER", "kg"); #单位
entry2.FDetailID = FDetailid(); #核算维度
goodsNo = self.proxy.GetExtFieldByName(detail.SaleGoods_ID,goodsDmoType ,"ExternalField1");
entry2.FDetailID.FDETAILID__FFLEX8 = Dictionary[str,Object]();
entry2.FDetailID.FDETAILID__FFLEX8.Add("FNumber", goodsNo);
voucher.FEntity.Add(entry2);
# 摘要:收【客户名】货款【审核日期】
# 科目编号:1122.01 应收账款_应收货款
# 核算维度:金蝶系统中客户编码/客户名称(对照)
# 借方金额:销售总金额
# 摘要:收【客户名】货款【审核日期】
# 科目编号:6001.01 主营业务收入_其他_冷鲜牛肉
# 核算维度:金蝶系统中存货编码/存货名称(对照)
# 单位:千克
# 单价:单价
# 数量:报价数量
# 贷方金额:金额

+ 2
- 1
WebFolder/config/plugins/B3_QiLianMuGe.plugin View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<Plugin xmlns="http://www.TSingSoft.com/Schemas/WPF.xsd" name="B3_QiLianMuGe" displayName="B3祁连牧歌" version="1.0" appVersion="$appVersion" schemaVersion="1.0" pluginClass="BWP.B3_QiLianMuGe.Web.PluginClass,B3_QiLianMuGe.Web">
<Requires>
<Plugin name="B3Sale" version="$appVersion" />
<Plugin name="B3ExportBase" version="$appVersion" />
</Requires>
<Assemblies>


Loading…
Cancel
Save