Commit 58641cd0 by guanzhenshan

修复月销售利润报表编辑数据保存不对的问题;增加半成品仓进销存的统计服务

parent 40ab3f24
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.30" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" />
<PackageReference Include="MySql.Data" Version="8.0.18" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bailun.DC.Common\Bailun.DC.Common.csproj" />
<ProjectReference Include="..\Bailun.DC.Models\Bailun.DC.Models.csproj" />
</ItemGroup>
</Project>
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Threading.Tasks;
namespace Bailun.DC.DailySemiPurchaseSellStock
{
class Program
{
//static async Task Main(string[] args)
//{
// Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
// var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
// {
// services.AddHostedService<Services>();
// });
// await builder.RunConsoleAsync();
//}
static void Main(string[] args)
{
var _services = new Services();
var start = DateTime.Parse("2019-09-01");
while (start.AddDays(1) < DateTime.Now)
{
Console.WriteLine(start);
_services.Init(start);
start = start.AddDays(1);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models
{
/// <summary>
/// 半成品每日销进比
/// </summary>
public class dc_semi_daily_purchase_sell_stock
{
/// <summary>
///
/// </summary>
public int id { get; set; }
/// <summary>
/// 记录时间
/// </summary>
public DateTime record_time { get; set; }
/// <summary>
/// sku
/// </summary>
public string bailun_sku { get; set; }
/// <summary>
/// Sku名称
/// </summary>
public string sku_title_cn { get; set; }
/// <summary>
/// 仓库编码
/// </summary>
public string warehouse_code { get; set; }
/// <summary>
/// 仓库名称
/// </summary>
public string warehouse_name { get; set; }
/// <summary>
/// 期初库存数
/// </summary>
public int start_stock_count { get; set; }
/// <summary>
/// 期初库存金额
/// </summary>
public decimal start_stock_amount { get; set; }
/// <summary>
/// 期初在途数量
/// </summary>
public int start_onway_count { get; set; }
/// <summary>
/// 期初在途金额
/// </summary>
public decimal start_onway_amount { get; set; }
/// <summary>
/// 期末库存数量
/// </summary>
public int end_stock_count { get; set; }
/// <summary>
/// 期末库存金额
/// </summary>
public decimal end_stock_amount { get; set; }
/// <summary>
/// 期末在途数
/// </summary>
public int end_onway_count { get; set; }
/// <summary>
/// 期末在途金额
/// </summary>
public decimal end_onway_amount { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 在库差异数量
/// </summary>
public int? diff_stock_count { get; set; }
/// <summary>
/// 在库差异金额
/// </summary>
public decimal? diff_stock_amount { get; set; }
/// <summary>
/// 在途差异数量
/// </summary>
public int? diff_onway_count { get; set; }
/// <summary>
/// 在途差异金额
/// </summary>
public decimal? diff_onway_amount { get; set; }
/// <summary>
/// 总数量
/// </summary>
public int count { get; set; }
/// <summary>
/// 总金额
/// </summary>
public int amount { get; set; }
}
}
...@@ -3597,6 +3597,8 @@ group by currency"; ...@@ -3597,6 +3597,8 @@ group by currency";
if (m.cost_sale_.HasValue) if (m.cost_sale_.HasValue)
{ {
obj.cost_sale = (obj.cost_sale - obj.cost_sale_) + m.cost_sale_.Value;
obj.cost_sale_ = m.cost_sale_.Value; obj.cost_sale_ = m.cost_sale_.Value;
} }
...@@ -3612,6 +3614,8 @@ group by currency"; ...@@ -3612,6 +3614,8 @@ group by currency";
if (m.ls_head_cost_.HasValue) if (m.ls_head_cost_.HasValue)
{ {
obj.ls_head_cost = (obj.ls_head_cost - obj.ls_head_cost_) + m.ls_head_cost_.Value;
obj.ls_head_cost_ = m.ls_head_cost_.Value; obj.ls_head_cost_ = m.ls_head_cost_.Value;
} }
...@@ -3622,6 +3626,8 @@ group by currency"; ...@@ -3622,6 +3626,8 @@ group by currency";
if (m.ls_tail_cost_.HasValue) if (m.ls_tail_cost_.HasValue)
{ {
obj.ls_tail_cost = (obj.ls_tail_cost - obj.ls_tail_cost_) + m.ls_tail_cost_.Value;
obj.ls_tail_cost_ = m.ls_tail_cost_.Value; obj.ls_tail_cost_ = m.ls_tail_cost_.Value;
} }
...@@ -3667,11 +3673,15 @@ group by currency"; ...@@ -3667,11 +3673,15 @@ group by currency";
if (m.pt_platform_ad_subscribe_fee_.HasValue) if (m.pt_platform_ad_subscribe_fee_.HasValue)
{ {
obj.pt_platform_ad_subscribe_fee = obj.pt_platform_ad_subscribe_fee - obj.pt_platform_ad_subscribe_fee_ + m.pt_platform_ad_subscribe_fee_.Value;
obj.pt_platform_ad_subscribe_fee_ = m.pt_platform_ad_subscribe_fee_.Value; obj.pt_platform_ad_subscribe_fee_ = m.pt_platform_ad_subscribe_fee_.Value;
} }
if (m.pt_platform_logistics_fee_.HasValue) if (m.pt_platform_logistics_fee_.HasValue)
{ {
obj.pt_platform_logistics_fee = obj.pt_platform_logistics_fee - obj.pt_platform_logistics_fee_ + m.pt_platform_logistics_fee_.Value;
obj.pt_platform_logistics_fee_ = m.pt_platform_logistics_fee_.Value; obj.pt_platform_logistics_fee_ = m.pt_platform_logistics_fee_.Value;
} }
...@@ -3681,19 +3691,19 @@ group by currency"; ...@@ -3681,19 +3691,19 @@ group by currency";
} }
//平台扣费及退款=平台费+ebay刊登费+paypal费用+平台物流费+广告及宣传费|订阅费+平台仓储费+退款 //平台扣费及退款=平台费+ebay刊登费+paypal费用+平台物流费+广告及宣传费|订阅费+平台仓储费+退款
obj.pt_count = obj.pt_platformfee + obj.pt_ebay_postingfee + obj.pt_paypal_fee + (obj.pt_platform_logistics_fee + obj.pt_platform_logistics_fee_) + (obj.pt_platform_ad_subscribe_fee + obj.pt_platform_ad_subscribe_fee_) + obj.pt_platform_storage_fee + obj.pt_refund_amount; obj.pt_count = obj.pt_platformfee + obj.pt_ebay_postingfee + obj.pt_paypal_fee + (obj.pt_platform_logistics_fee ) + (obj.pt_platform_ad_subscribe_fee ) + obj.pt_platform_storage_fee + obj.pt_refund_amount;
//回款=销售额-平台扣费及退款 //回款=销售额-平台扣费及退款
obj.pt_incoming = obj.amount_sale - obj.pt_count; obj.pt_incoming = obj.amount_sale - obj.pt_count;
//物流仓储费用=头程运输+尾程物流+海外仓的仓储费+平台操作费 //物流仓储费用=头程运输+尾程物流+海外仓的仓储费+平台操作费
obj.ls_count = (obj.ls_head_cost + obj.ls_head_cost_) + (obj.ls_tail_cost + obj.ls_tail_cost_) + obj.ls_oversea_storage + obj.ls_platform_operation_fee; obj.ls_count = (obj.ls_head_cost) + (obj.ls_tail_cost ) + obj.ls_oversea_storage + obj.ls_platform_operation_fee;
//销售费用合计=平台扣费及退款+物流仓储费用 //销售费用合计=平台扣费及退款+物流仓储费用
obj.sale_fee_count = obj.pt_count + obj.ls_count; obj.sale_fee_count = obj.pt_count + obj.ls_count;
//销售利润=销售额-成本-销售费用合计 //销售利润=销售额-成本-销售费用合计
obj.sale_profit = obj.amount_sale - (obj.cost_sale + obj.cost_sale_) - obj.sale_fee_count; obj.sale_profit = obj.amount_sale - (obj.cost_sale ) - obj.sale_fee_count;
//销售毛利率 = 销售利润/销售额 //销售毛利率 = 销售利润/销售额
obj.sale_profit_rate = obj.sale_profit / obj.amount_sale; obj.sale_profit_rate = obj.sale_profit / obj.amount_sale;
......
...@@ -39,6 +39,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bailun.DC.DailyPurchaseSell ...@@ -39,6 +39,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bailun.DC.DailyPurchaseSell
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bailun.DC.MonthSaleProfit", "Bailun.DC.MonthSaleProfit\Bailun.DC.MonthSaleProfit.csproj", "{85C62851-D6B3-4D6D-B8C5-D02EAA6838B8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bailun.DC.MonthSaleProfit", "Bailun.DC.MonthSaleProfit\Bailun.DC.MonthSaleProfit.csproj", "{85C62851-D6B3-4D6D-B8C5-D02EAA6838B8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bailun.DC.DailySemiPurchaseSellStock", "Bailun.DC.DailySemiPurchaseSellStock\Bailun.DC.DailySemiPurchaseSellStock.csproj", "{BA2836C9-40CD-41FE-9BAD-7D897BB62AF8}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
...@@ -113,6 +115,10 @@ Global ...@@ -113,6 +115,10 @@ Global
{85C62851-D6B3-4D6D-B8C5-D02EAA6838B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {85C62851-D6B3-4D6D-B8C5-D02EAA6838B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85C62851-D6B3-4D6D-B8C5-D02EAA6838B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {85C62851-D6B3-4D6D-B8C5-D02EAA6838B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85C62851-D6B3-4D6D-B8C5-D02EAA6838B8}.Release|Any CPU.Build.0 = Release|Any CPU {85C62851-D6B3-4D6D-B8C5-D02EAA6838B8}.Release|Any CPU.Build.0 = Release|Any CPU
{BA2836C9-40CD-41FE-9BAD-7D897BB62AF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA2836C9-40CD-41FE-9BAD-7D897BB62AF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA2836C9-40CD-41FE-9BAD-7D897BB62AF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA2836C9-40CD-41FE-9BAD-7D897BB62AF8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
...@@ -129,6 +135,7 @@ Global ...@@ -129,6 +135,7 @@ Global
{8DE8F6DB-679A-4012-B84E-5D317C7388A0} = {AE2CE86A-8538-4142-920F-684DCF47C064} {8DE8F6DB-679A-4012-B84E-5D317C7388A0} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{10552EC1-917C-4A2D-A483-B16E5930D6FA} = {AE2CE86A-8538-4142-920F-684DCF47C064} {10552EC1-917C-4A2D-A483-B16E5930D6FA} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{85C62851-D6B3-4D6D-B8C5-D02EAA6838B8} = {AE2CE86A-8538-4142-920F-684DCF47C064} {85C62851-D6B3-4D6D-B8C5-D02EAA6838B8} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{BA2836C9-40CD-41FE-9BAD-7D897BB62AF8} = {AE2CE86A-8538-4142-920F-684DCF47C064}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6E53AF28-A282-4FB0-A769-EAEA9769C02A} SolutionGuid = {6E53AF28-A282-4FB0-A769-EAEA9769C02A}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment