Commit 2da12384 by zhoujinhui

存货计价导出

parent 3ec2cfa2
namespace Bailun.DC.Models.Dtos.Stock using System.Collections.Generic;
using System.Data;
namespace Bailun.DC.Models.Dtos.Stock
{ {
/// <summary> /// <summary>
/// 获取存货计价数据返回参数信息 /// 获取存货计价数据返回参数信息
...@@ -11,9 +14,24 @@ ...@@ -11,9 +14,24 @@
public dynamic Data { get; set; } public dynamic Data { get; set; }
/// <summary> /// <summary>
/// Excel导出用
/// </summary>
public DataTable DataTable { get; set; }
/// <summary>
/// 前端Vue表头 /// 前端Vue表头
/// </summary> /// </summary>
public string ColumnText { get; set; } public string ColumnText { get; set; }
public int Total { get; set; } public int Total { get; set; }
/// <summary>
/// 导出标题
/// </summary>
public List<string> ExportCNTitle { get; set; }
/// <summary>
/// 导出数据列名称
/// </summary>
public List<string> ExportDataTitle { get; set; }
} }
} }
namespace Bailun.DC.Models.Dtos.Stock
{
/// <summary>
/// 存货统计
/// </summary>
public class GetMonthStockWeightingSummaryDto
{
/// <summary>
/// sku
/// </summary>
public string bailun_sku { get; set; }
/// <summary>
/// 总金额
/// </summary>
public decimal total_price { get; set; }
/// <summary>
/// 总数量
/// </summary>
public int total_count { get; set; }
/// <summary>
/// 月末库存
/// </summary>
public int on_hand_stock { get; set; }
}
}
...@@ -9,6 +9,36 @@ namespace Bailun.DC.Models.Stock ...@@ -9,6 +9,36 @@ namespace Bailun.DC.Models.Stock
/// </summary> /// </summary>
public class dc_base_wms_stock_flow public class dc_base_wms_stock_flow
{ {
public dc_base_wms_stock_flow()
{
}
/// <summary>
///
/// </summary>
/// <param name="productStockFlow"></param>
public dc_base_wms_stock_flow(ProductStockFlowApiResponseDto productStockFlow)
{
sys_serial_number = productStockFlow.SysSerialNumber;
bailun_sku = productStockFlow.Sku;
change_quantity = productStockFlow.ChangeQuantity;
warehouse_code = productStockFlow.WarehouseCode;
warehouse_name = productStockFlow.WarehouseName;
third_sys_order_no = productStockFlow.ThirdSysOrderNo;
third_sys_order_type = productStockFlow.ThirdSysOrderType;
system_source = productStockFlow.SystemSource;
target_ware_no = productStockFlow.TargetWareNo;
target_ware_name = productStockFlow.TargetWareName;
availabel_stock = productStockFlow.AvailabelStock;
on_hand_stock = productStockFlow.OnHandStock;
in_bound_stock = productStockFlow.InboundStock;
order_creation_time = productStockFlow.OrderCreationTime;
create_user_name = productStockFlow.CreateUserName;
wms_creation_time = productStockFlow.CreationTime;
create_time = DateTime.Now;
}
/// <summary> /// <summary>
/// id /// id
/// </summary> /// </summary>
...@@ -99,30 +129,6 @@ namespace Bailun.DC.Models.Stock ...@@ -99,30 +129,6 @@ namespace Bailun.DC.Models.Stock
/// </summary> /// </summary>
public DateTime create_time { get; set; } public DateTime create_time { get; set; }
/// <summary>
///
/// </summary>
/// <param name="productStockFlow"></param>
public void WmsRepsonseToModel(ProductStockFlowApiResponseDto productStockFlow)
{
sys_serial_number = productStockFlow.SysSerialNumber;
bailun_sku = productStockFlow.Sku;
change_quantity = productStockFlow.ChangeQuantity;
warehouse_code = productStockFlow.WarehouseCode;
warehouse_name = productStockFlow.WarehouseName;
third_sys_order_no = productStockFlow.ThirdSysOrderNo;
third_sys_order_type = productStockFlow.ThirdSysOrderType;
system_source = productStockFlow.SystemSource;
target_ware_no = productStockFlow.TargetWareNo;
target_ware_name = productStockFlow.TargetWareName;
availabel_stock = productStockFlow.AvailabelStock;
on_hand_stock = productStockFlow.OnHandStock;
in_bound_stock = productStockFlow.InboundStock;
order_creation_time = productStockFlow.OrderCreationTime;
create_user_name = productStockFlow.CreateUserName;
wms_creation_time = productStockFlow.CreationTime;
create_time = DateTime.Now;
}
} }
/// <summary> /// <summary>
......
...@@ -9,6 +9,7 @@ using Bailun.DC.Models.Stock; ...@@ -9,6 +9,7 @@ using Bailun.DC.Models.Stock;
using MySql.Data; using MySql.Data;
using System.Data; using System.Data;
using Bailun.DC.Models.Warehouse; using Bailun.DC.Models.Warehouse;
using Bailun.DC.Models.Dtos.Stock;
namespace Bailun.DC.Services namespace Bailun.DC.Services
{ {
...@@ -1313,6 +1314,36 @@ namespace Bailun.DC.Services ...@@ -1313,6 +1314,36 @@ namespace Bailun.DC.Services
} }
#endregion #endregion
#region WMS库存流水
/// <summary>
/// 写入WMS库存流水记录
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool InsertWmsStockFlow(dc_base_wms_stock_flow model)
{
var sql = @"
INSERT INTO `dc_base_wms_stock_flow` (`sys_serial_number`, `bailun_sku`, `change_quantity`,
`warehouse_code`, `warehouse_name`, `third_sys_order_no`, `third_sys_order_type`, `system_source`,
`target_ware_no`, `target_ware_name`, `availabel_stock`, `on_hand_stock`, `in_bound_stock`,
`order_creation_time`, `create_user_name`, `wms_creation_time`, `create_time`)
VALUES (@sys_serial_number, @bailun_sku, @change_quantity,
@warehouse_code, @warehouse_name, @third_sys_order_no, @third_sys_order_type, @system_source,
@target_ware_no, @target_ware_name, @availabel_stock, @on_hand_stock, @in_bound_stock,
@order_creation_time, @create_user_name, @wms_creation_time, @create_time);
";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var count = cn.Execute(sql, model);
return count>0;
}
}
#endregion
} }
} }
...@@ -11,9 +11,13 @@ using Bailun.ServiceFabric.Core.Extension; ...@@ -11,9 +11,13 @@ using Bailun.ServiceFabric.Core.Extension;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data;
using System.Dynamic;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
...@@ -175,8 +179,8 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -175,8 +179,8 @@ namespace Bailun.DC.WebApi.Controllers
foreach (var item in displayNameList) foreach (var item in displayNameList)
{ {
if (item.KeyName == "id" || item.KeyName == "month") continue; if (item.KeyName == "id" || item.KeyName == "month") continue;
var isFirst = firstList.Count(x => x.ParentName.ToString() == item.KeyName) > 0?1:0; var isFirst = firstList.Count(x => x.ParentName.ToString() == item.KeyName) > 0 ? 1 : 0;
jsonStr.Append("{\"ItemName\":\"" + item.KeyName + "\",\"Item\":\"" + item.DisplayName + "\",\"IsFirst\":"+ isFirst + ",\"FirstId\":\""+ (int)item.ParentName+ "\","); jsonStr.Append("{\"ItemName\":\"" + item.KeyName + "\",\"Item\":\"" + item.DisplayName + "\",\"IsFirst\":" + isFirst + ",\"FirstId\":\"" + (int)item.ParentName + "\",");
excelItemStr = item.DisplayName + "|"; excelItemStr = item.DisplayName + "|";
foreach (var subItem in dataList) foreach (var subItem in dataList)
{ {
...@@ -337,10 +341,10 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -337,10 +341,10 @@ namespace Bailun.DC.WebApi.Controllers
/// <param name="financecategory"></param> /// <param name="financecategory"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("getPlatformTypeMonthlyStatistics")] [HttpGet("getPlatformTypeMonthlyStatistics")]
public CommonApiResponseDto<List<PlatformTypeMonthlyStatisticsDto>> GetPlatformTypeMonthlyStatistics(string month, string financecategory,string isCost) public CommonApiResponseDto<List<PlatformTypeMonthlyStatisticsDto>> GetPlatformTypeMonthlyStatistics(string month, string financecategory, string isCost)
{ {
var result = new CommonApiResponseDto<List<PlatformTypeMonthlyStatisticsDto>> { Data = new List<PlatformTypeMonthlyStatisticsDto>()}; var result = new CommonApiResponseDto<List<PlatformTypeMonthlyStatisticsDto>> { Data = new List<PlatformTypeMonthlyStatisticsDto>() };
result.Data = new FinanceService().GetMonthSalesProfiOrderSummary(month, financecategory,isCost); result.Data = new FinanceService().GetMonthSalesProfiOrderSummary(month, financecategory, isCost);
return result; return result;
} }
...@@ -350,7 +354,7 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -350,7 +354,7 @@ namespace Bailun.DC.WebApi.Controllers
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("getMonthProfitOrderDetailPage")] [HttpPost("getMonthProfitOrderDetailPage")]
public CommonApiResponseDto<MonthProfitOrderDetailPageOutputDto> GetMonthProfitOrderDetailPage([FromBody]MonthProfitOrderDetailPageInputDto input) public CommonApiResponseDto<MonthProfitOrderDetailPageOutputDto> GetMonthProfitOrderDetailPage([FromBody] MonthProfitOrderDetailPageInputDto input)
{ {
return new FinanceService().GetMonthProfitOrderDetailPage(input); return new FinanceService().GetMonthProfitOrderDetailPage(input);
} }
...@@ -428,7 +432,7 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -428,7 +432,7 @@ namespace Bailun.DC.WebApi.Controllers
/// <param name="feeName"></param> /// <param name="feeName"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("getMonthProfitFeeManagementCostDetail")] [HttpGet("getMonthProfitFeeManagementCostDetail")]
public CommonApiResponseDto<List<FinanceDetailsDto>> GetMonthProfitFeeManagementCostDetail(string month,string feeName) public CommonApiResponseDto<List<FinanceDetailsDto>> GetMonthProfitFeeManagementCostDetail(string month, string feeName)
=> new FinanceService().GetMonthProfitFeeManagementCostDetail(month, feeName); => new FinanceService().GetMonthProfitFeeManagementCostDetail(month, feeName);
/// <summary> /// <summary>
/// 月销售利润平台费用明细 /// 月销售利润平台费用明细
...@@ -458,7 +462,7 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -458,7 +462,7 @@ namespace Bailun.DC.WebApi.Controllers
[HttpPost("exportMonthProfitFeePlatformFeeDetail")] [HttpPost("exportMonthProfitFeePlatformFeeDetail")]
public ActionResult ExportMonthProfitFeePlatformFeeDetail(GetMonthProfitPlatformDetailInput input) public ActionResult ExportMonthProfitFeePlatformFeeDetail(GetMonthProfitPlatformDetailInput input)
{ {
var dataList = new FinanceService().ExportMonthProfitFeePlatformFeeDetail(input); var dataList = new FinanceService().ExportMonthProfitFeePlatformFeeDetail(input);
var colNames = new List<string> { "平台", "站点", "账单时间", "单号", "币种", "原币金额", "汇率", "RMB金额", "费用字段说明", "财务分类归集说明", "数据中心费用类型", "会计科目编码" var colNames = new List<string> { "平台", "站点", "账单时间", "单号", "币种", "原币金额", "汇率", "RMB金额", "费用字段说明", "财务分类归集说明", "数据中心费用类型", "会计科目编码"
, "项目编码" }; , "项目编码" };
var list = new List<string>(); var list = new List<string>();
...@@ -536,8 +540,8 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -536,8 +540,8 @@ namespace Bailun.DC.WebApi.Controllers
[HttpPost("exportMonthSalesProfitDetail")] [HttpPost("exportMonthSalesProfitDetail")]
public ActionResult ExportMonthSalesProfitDetail(MonthProfitOrderDetailPageInputDto input) public ActionResult ExportMonthSalesProfitDetail(MonthProfitOrderDetailPageInputDto input)
{ {
var dataList = new FinanceService().GetMonthSalesProfitDetail(input,false); var dataList = new FinanceService().GetMonthSalesProfitDetail(input, false);
var colNames = new List<string> { "财务分类", "平台类型", "订单号", "SKU", "销售利润", "发货量", "发货时间", "创建时间"}; var colNames = new List<string> { "财务分类", "平台类型", "订单号", "SKU", "销售利润", "发货量", "发货时间", "创建时间" };
var list = new List<string>(); var list = new List<string>();
foreach (var item in dataList.Data.Data) foreach (var item in dataList.Data.Data)
{ {
...@@ -554,15 +558,15 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -554,15 +558,15 @@ namespace Bailun.DC.WebApi.Controllers
ms.Position = 0; ms.Position = 0;
return File(ms, "text/csv", $"{input.Month}_月销售费用合计》费用利润表明细.csv"); return File(ms, "text/csv", $"{input.Month}_月销售费用合计》费用利润表明细.csv");
} }
/// <summary> /// <summary>
/// 同步月利润销售报告 /// 同步月利润销售报告
/// </summary> /// </summary>
/// <param name="time"></param> /// <param name="time"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("syncMonthSalesProfit")] [HttpGet("syncMonthSalesProfit")]
public bool SyncMonthSalesProfit(string time) public bool SyncMonthSalesProfit(string time)
{ {
return new FinanceService().SyncMonthSalesProfit(time); return new FinanceService().SyncMonthSalesProfit(time);
//var sql = "select * from dc_month_sales_profit_orderdetail limit 1"; //var sql = "select * from dc_month_sales_profit_orderdetail limit 1";
//var data = Dapper.SimpleCRUD.Query<dc_month_sales_profit_orderdetail>(sql, null, Common.GlobalConfig.ConnectionString).FirstOrDefault(); //var data = Dapper.SimpleCRUD.Query<dc_month_sales_profit_orderdetail>(sql, null, Common.GlobalConfig.ConnectionString).FirstOrDefault();
//return data; //return data;
...@@ -574,7 +578,7 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -574,7 +578,7 @@ namespace Bailun.DC.WebApi.Controllers
/// <returns></returns> /// <returns></returns>
[HttpGet("syncMonthSalesProfiOrderDetail")] [HttpGet("syncMonthSalesProfiOrderDetail")]
public bool SyncMonthSalesProfiOrderDetail(string date) public bool SyncMonthSalesProfiOrderDetail(string date)
=>new FinanceService().SyncMonthSalesProfiOrderDetail(date); => new FinanceService().SyncMonthSalesProfiOrderDetail(date);
#endregion #endregion
#region 会计科目 #region 会计科目
...@@ -628,6 +632,42 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -628,6 +632,42 @@ namespace Bailun.DC.WebApi.Controllers
{ {
return new FinanceService().GetMonthStockWeightingList(bailunSku, month, page, limit); return new FinanceService().GetMonthStockWeightingList(bailunSku, month, page, limit);
} }
/// <summary>
/// 导出明细
/// </summary>
/// <param name="bailunSku"></param>
/// <param name="month"></param>
/// <returns></returns>
[HttpPost("exportMonthStockWeighting")]
public ActionResult ExportMonthStockWeighting(string bailunSku, string month)
{
var response = new FinanceService().GetMonthStockWeightingList(bailunSku, month, 0, 0);
var list = new List<string>();
for (int i = 0; i < response.Data.DataTable.Rows.Count; i++)
{
StringBuilder dataStr = new StringBuilder();
foreach (var title in response.Data.ExportDataTitle)
{
string value = response.Data.DataTable.Rows[i][title].ToString();
dataStr.Append(value + "|");
}
var dataStrValue = dataStr.ToString().TrimEnd('|');
list.Add(dataStrValue);
}
var guid = Guid.NewGuid().ToString();
var filepath = _hostingEnvironment.WebRootPath + "\\Files\\Report\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\";
ToCSV(list, response.Data.ExportCNTitle, guid, filepath);
var ms = new System.IO.MemoryStream();
using (var f = new System.IO.FileStream(filepath + guid + ".csv", System.IO.FileMode.Open))
{
f.CopyTo(ms);
}
ms.Position = 0;
return File(ms, "text/csv", "存货计价.csv");
}
#endregion #endregion
} }
} }
...@@ -93,6 +93,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bailun.DC.SyncMonthSalesPro ...@@ -93,6 +93,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bailun.DC.SyncMonthSalesPro
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bailun.DC.ExportTask", "Bailun.DC.ExportTask\Bailun.DC.ExportTask.csproj", "{C4C4990D-14DC-4B76-A7EB-6F3FC5BE8B94}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bailun.DC.ExportTask", "Bailun.DC.ExportTask\Bailun.DC.ExportTask.csproj", "{C4C4990D-14DC-4B76-A7EB-6F3FC5BE8B94}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bailun.DC.SyncMonthStockWeighting", "..\Bailun.DC.SyncMonthStockWeighting\Bailun.DC.SyncMonthStockWeighting.csproj", "{ED1647F9-6EA3-41A8-805F-DC46B8AD8835}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
...@@ -275,6 +277,10 @@ Global ...@@ -275,6 +277,10 @@ Global
{C4C4990D-14DC-4B76-A7EB-6F3FC5BE8B94}.Debug|Any CPU.Build.0 = Debug|Any CPU {C4C4990D-14DC-4B76-A7EB-6F3FC5BE8B94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4C4990D-14DC-4B76-A7EB-6F3FC5BE8B94}.Release|Any CPU.ActiveCfg = Release|Any CPU {C4C4990D-14DC-4B76-A7EB-6F3FC5BE8B94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4C4990D-14DC-4B76-A7EB-6F3FC5BE8B94}.Release|Any CPU.Build.0 = Release|Any CPU {C4C4990D-14DC-4B76-A7EB-6F3FC5BE8B94}.Release|Any CPU.Build.0 = Release|Any CPU
{ED1647F9-6EA3-41A8-805F-DC46B8AD8835}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED1647F9-6EA3-41A8-805F-DC46B8AD8835}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED1647F9-6EA3-41A8-805F-DC46B8AD8835}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED1647F9-6EA3-41A8-805F-DC46B8AD8835}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
...@@ -317,6 +323,7 @@ Global ...@@ -317,6 +323,7 @@ Global
{B0E4B05A-2330-46E1-8CF7-C6D69DBB7850} = {AE2CE86A-8538-4142-920F-684DCF47C064} {B0E4B05A-2330-46E1-8CF7-C6D69DBB7850} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{DEAD70F9-01C4-4178-AB0B-1C4874AA7A61} = {AE2CE86A-8538-4142-920F-684DCF47C064} {DEAD70F9-01C4-4178-AB0B-1C4874AA7A61} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{C4C4990D-14DC-4B76-A7EB-6F3FC5BE8B94} = {AE2CE86A-8538-4142-920F-684DCF47C064} {C4C4990D-14DC-4B76-A7EB-6F3FC5BE8B94} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{ED1647F9-6EA3-41A8-805F-DC46B8AD8835} = {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