Commit 8e569644 by guanzhenshan

1、完成采购入库,调拨入库,发货明细的导出功能

2、增加发生额统计服务
parent 247393e6
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="1.60.6" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="2.2.0" />
<PackageReference Include="MySql.Data" Version="8.0.17" />
<PackageReference Include="Quartz" Version="2.6.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bailun.DC.Common\Bailun.DC.Common.csproj" />
<ProjectReference Include="..\Bailun.DC.Models\Bailun.DC.Models.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
</Project>
FROM microsoft/dotnet:2.1-runtime AS base
WORKDIR /app
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY Bailun.DC.HappenAmount/Bailun.DC.HappenAmount.csproj Bailun.DC.HappenAmount/
COPY Bailun.DC.Common/Bailun.DC.Common.csproj Bailun.DC.Common/
COPY Bailun.DC.Models/Bailun.DC.Models.csproj Bailun.DC.Models/
RUN dotnet restore Bailun.DC.HappenAmount/Bailun.DC.HappenAmount.csproj
COPY . .
WORKDIR /src/Bailun.DC.HappenAmount
RUN dotnet build Bailun.DC.HappenAmount.csproj -c Release -o /app
FROM build AS publish
RUN dotnet publish Bailun.DC.HappenAmount.csproj -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Bailun.DC.HappenAmount.dll"]
using System;
namespace Bailun.DC.HappenAmount
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.HappenAmount
{
public class Services
{
public void Init(DateTime start,DateTime end)
{
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.ExportServices
{
/// <summary>
/// 调拨入库
/// </summary>
public class mAllotPutin
{
/// <summary>
/// 调拨单号
/// </summary>
public string transfer_order_id { get; set; }
/// <summary>
/// 仓库编码
/// </summary>
public string warehouse_code { get; set; }
/// <summary>
/// 仓库名称
/// </summary>
public string warehouse_name { get; set; }
/// <summary>
/// Sku
/// </summary>
public string bailun_sku { get; set; }
/// <summary>
/// 调拨数量
/// </summary>
public int count { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime create_time { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.ExportServices
{
/// <summary>
/// 发货明细
/// </summary>
public class mShipping
{
/// <summary>
/// 平台单号
/// </summary>
public string origin_order_id { get; set; }
/// <summary>
/// 配货单号
/// </summary>
public string pick_order_id { get; set; }
/// <summary>
/// 运单号
/// </summary>
public string logistics_order_id { get; set; }
/// <summary>
/// 发货时间
/// </summary>
public DateTime shipping_time { get; set; }
/// <summary>
/// 仓库编码
/// </summary>
public string warehouse_code { get; set; }
/// <summary>
/// 仓库名称
/// </summary>
public string warehouse_name { get; set; }
/// <summary>
/// 发货数量
/// </summary>
public int quantity_shipped { get; set; }
/// <summary>
/// SKU
/// </summary>
public string bailun_sku { get; set; }
/// <summary>
/// 采购金额
/// </summary>
public decimal amount { get; set; }
}
}
......@@ -21,11 +21,11 @@ namespace Bailun.DC.Services
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public List<mPurchasePutin> ListPurchasePutin(DateTime start,DateTime end)
public List<mPurchasePutin> ListPurchasePutin(DateTime start,DateTime end,int companyid)
{
var sql = $@"select t1.warehouse_code,t1.warehouse_name,t1.bailun_sku,t1.count,t1.update_time,inbound_id as no from dc_base_purchase_inbound t1
join dc_base_purchase t2 on t1.purchase_id = t2.purchase_id and t1.bailun_sku = t2.bailun_sku and t2.has_transfer = 0 and t2.`status`> 0
where t1.`status`= 1 and t1.update_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.update_time < '{end.ToString("yyyy-MM-dd HH:mm:ss")}";
where t1.`status`= 1 and t1.update_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.update_time < '{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
......@@ -40,9 +40,65 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 调拨入库明细
/// </summary>
/// <param name="start">开始时间</param>
/// <param name="end">结束时间</param>
/// <param name="companyid">公司id</param>
/// <returns></returns>
public List<mAllotPutin> ListAllotPutin(DateTime start, DateTime end, int companyid)
{
var sql = $@"select t1.warehouse_code,t2.warehouse_name,t1.bailun_sku,t1.count,t1.transfer_order_id,t1.create_time from dc_base_transfer_inbound t1
left join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code where t1.deleted=0 and t1.count>0 and t1.create_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.create_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' -- and company_id={companyid}";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var obj = cn.Query<mAllotPutin>(sql, null, null, true, 2 * 60).AsList();
return obj;
}
}
#endregion
#region 发货
/// <summary>
/// 发货明细
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="companyid"></param>
/// <returns></returns>
public List<mShipping> ListShipping(DateTime start, DateTime end, int companyid)
{
var sql = $@"select t1.origin_order_id,t1.pick_order_id,t1.logistics_order_id,t1.shipping_time,t1.warehouse_code,t1.warehouse_name,t1.bailun_sku,t1.quantity_shipped,(t1.quantity_shipped*t2.unit_price) amount from dc_base_oms_pick t1
left join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku
where t1.has_delete=0 and t1.shipping_status='TotalShipping' and t1.shipping_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}'
";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var obj = cn.Query<mShipping>(sql, null, null, true, 2 * 60).AsList();
return obj;
}
}
#endregion
}
}
......@@ -84,6 +84,7 @@ namespace Bailun.DC.SkuDailyPurchaseAndSales
group by tb.warehouse_code,tb.bailun_sku";
var objPutin = cn.Query<Models.mSkuCount>(sql, null, null, true, 2 * 60).AsList();
//发货的
sql = $@"select t1.warehouse_code,t1.warehouse_name,t1.bailun_sku,sum(t1.quantity_shipped) count,sum(t1.quantity_shipped*t2.unit_price) amount from dc_base_oms_pick t1
left join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku
where t1.has_delete=0 and t1.shipping_status='TotalShipping' and t1.shipping_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}'
......
......@@ -2,21 +2,111 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
namespace Bailun.DC.Web.Areas.ExportFile.Controllers
{
[Area("ExportFile")]
public class PutinController : Controller
public class PutinController : Base.BaseController
{
private readonly IHostingEnvironment _hostingEnvironment;
public PutinController(IHostingEnvironment hostingEnvironment)
{
_hostingEnvironment = hostingEnvironment;
}
public IActionResult Index()
{
return View();
}
public ActionResult PurchaseAndAllot(DateTime start, DateTime end)
/// <summary>
/// 导出采购入库单
/// </summary>
/// <param name="start">开始日期</param>
/// <param name="end">结束日期</param>
/// <param name="companyid">公司id</param>
/// <returns></returns>
public ActionResult ExportPurchasePutin(DateTime start, DateTime end,int companyid)
{
return View();
if (start.AddDays(31) < end)
{
return View("时间跨度不能大于一个月");
}
var _service = new Services.ExportServices();
var objPurchasePutin = _service.ListPurchasePutin(start, end, companyid);
var colNames = new List<string> {"采购入库单号","Sku","仓库编码", "仓库名称", "入库数量",
"入库时间" };
var list = new List<string>();
foreach (var item in objPurchasePutin)
{
list.Add(item.no + "|" + item.bailun_sku + "|" + item.warehouse_code + "|" + item.warehouse_name + "|" + item.count + "|" +
item.update_time.ToString("yyyy-MM-dd HH:mm:ss"));
}
var guid = Guid.NewGuid().ToString();
var filename = "采购入库明细"+start.ToString("yyyy-MM-dd")+"至"+end.ToString("yyyy-MM-dd") ;
var filepath = _hostingEnvironment.WebRootPath + "\\Files\\Report\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\";
ToCSV(list, colNames, 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", filename + ".csv");
}
/// <summary>
/// 导出调拨入库明细
/// </summary>
/// <param name="start">开始日期</param>
/// <param name="end">结束日期</param>
/// <param name="companyid">公司id</param>
/// <returns></returns>
public ActionResult ExportAllotPutin(DateTime start, DateTime end, int companyid)
{
if (start.AddDays(31) < end)
{
return View("时间跨度不能大于一个月");
}
var _service = new Services.ExportServices();
var obj = _service.ListAllotPutin(start, end, companyid);
var colNames = new List<string> {"调拨单号","Sku","仓库编码", "仓库名称", "入库数量",
"入库时间" };
var list = new List<string>();
foreach (var item in obj)
{
list.Add(item.transfer_order_id + "|" + item.bailun_sku + "|" + item.warehouse_code + "|" + item.warehouse_name + "|" + item.count + "|" +
item.create_time.ToString("yyyy-MM-dd HH:mm:ss"));
}
var guid = Guid.NewGuid().ToString();
var filename = "调拨入库明细" + start.ToString("yyyy-MM-dd") + "至" + end.ToString("yyyy-MM-dd");
var filepath = _hostingEnvironment.WebRootPath + "\\Files\\Report\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\";
ToCSV(list, colNames, 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", filename + ".csv");
}
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
namespace Bailun.DC.Web.Areas.ExportFile.Controllers
{
[Area("ExportFile")]
public class ShippingController : Base.BaseController
{
private readonly IHostingEnvironment _hostingEnvironment;
public ShippingController(IHostingEnvironment hostingEnvironment)
{
_hostingEnvironment = hostingEnvironment;
}
/// <summary>
/// 发货明细
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="companyid"></param>
/// <returns></returns>
public ActionResult ListShipping(DateTime start, DateTime end, int companyid)
{
var _service = new Services.ExportServices();
var obj = _service.ListShipping(start, end, companyid);
var colNames = new List<string> {"平台单号","配货单号","运单号", "仓库编码", "仓库名称",
"Sku","发货数量","采购金额","发货时间" };
var list = new List<string>();
foreach (var item in obj)
{
list.Add(item.origin_order_id + "|" + item.pick_order_id + "|" + item.logistics_order_id + "|" + item.warehouse_code + "|" + item.warehouse_name + "|" +
item.bailun_sku + "|" + item.quantity_shipped + "|" + item.amount + "|"+item.shipping_time.ToString("yyyy-MM-dd HH:mm:ss"));
}
var guid = Guid.NewGuid().ToString();
var filename = "发货明细" + start.ToString("yyyy-MM-dd") + "至" + end.ToString("yyyy-MM-dd");
var filepath = _hostingEnvironment.WebRootPath + "\\Files\\Report\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\";
ToCSV(list, colNames, 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", filename + ".csv");
}
}
}
\ No newline at end of file
......@@ -7,6 +7,10 @@ using Bailun.DC.Models;
using Bailun.DC.Services;
using Newtonsoft.Json;
using Microsoft.AspNetCore.Hosting;
using Bailun.ServiceFabric.Authorize;
using Bailun.ServiceFabric.Core.Extension.HttpContext;
using Bailun.ServiceFabric.Core.Extension;
using Bailun.ServiceFabric.Extension;
namespace Bailun.DC.Web.Areas.Reports.Controllers
{
......@@ -514,8 +518,11 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="end"></param>
/// <param name="t"></param>
/// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
public string ListDailyPurchaseSalesJson(BtTableParameter parameter, DateTime start, DateTime end,int t)
{
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
var _service = new Services.WareHouseServices();
var total = 0;
var obj = _service.ListDailyPurchaseSale(parameter, start, end, ref total);
......@@ -561,7 +568,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
amount_purchase = (t == 1 ? countM.amount_purchase : countM.amount_putin).ToString("N2"),
diff_count = t == 1 ? countM.difference_count : countM.diff_putin_count,
diff_amount = (t == 1 ? countM.difference_amount : countM.diff_putin_amount).ToString("N2"),
}
},
companyid
});
}
......
......@@ -51,6 +51,7 @@
<script src="~/js/bootstrap-table-fixed-columns.js" type="text/javascript"></script>
<script type="text/javascript">
var tb;
var companyid = 0;
$(document).ready(function () {
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
......@@ -104,6 +105,8 @@
}
}
}
companyid = d.companyid;
}
}, {
fixedcol: true,
......@@ -117,8 +120,15 @@
function exportlistputin() {
if (confirm("确定要导出吗?")) {
window.open('@Url.Content("~/Reports/Orders/ExportEbayOrders")' + '?' + $("#toolbar").serialize(), '_blank');
if (confirm("确定要导出入库明细吗?")) {
window.open('@Url.Content("~/ExportFile/Putin/ExportPurchasePutin")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid, '_blank');
window.open('@Url.Content("~/ExportFile/Putin/ExportAllotPutin")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid, '_blank');
}
}
function exportlistshipping() {
if (confirm("确定要导出入库明细吗?")) {
window.open('@Url.Content("~/ExportFile/Shipping/ListShipping")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid, '_blank');
}
}
......
......@@ -295,8 +295,7 @@ namespace Bailun.DC.Web.Controllers
else if (m.type == 2) //广告费
{
arrtype = new List<string> {
"CustomCode",
"Unknown"
"CustomCode"
};
}
......
......@@ -31,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bailun.DC.SkuDataWareHouse"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bailun.DC.SkuDailyPurchaseAndSales", "Bailun.DC.SkuDailyPurchaseAndSales\Bailun.DC.SkuDailyPurchaseAndSales.csproj", "{DD391409-2440-4332-8400-BE44A5140D89}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bailun.DC.HappenAmount", "Bailun.DC.HappenAmount\Bailun.DC.HappenAmount.csproj", "{D47B1C2E-BD79-4D41-87E0-D7749F65371E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -89,6 +91,10 @@ Global
{DD391409-2440-4332-8400-BE44A5140D89}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD391409-2440-4332-8400-BE44A5140D89}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD391409-2440-4332-8400-BE44A5140D89}.Release|Any CPU.Build.0 = Release|Any CPU
{D47B1C2E-BD79-4D41-87E0-D7749F65371E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D47B1C2E-BD79-4D41-87E0-D7749F65371E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D47B1C2E-BD79-4D41-87E0-D7749F65371E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D47B1C2E-BD79-4D41-87E0-D7749F65371E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -101,6 +107,7 @@ Global
{91F08169-1D64-479B-B877-88FCBDDDE90B} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{FAB2A012-44D0-42D0-9EAD-1798D8332B66} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{DD391409-2440-4332-8400-BE44A5140D89} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{D47B1C2E-BD79-4D41-87E0-D7749F65371E} = {AE2CE86A-8538-4142-920F-684DCF47C064}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6E53AF28-A282-4FB0-A769-EAEA9769C02A}
......
......@@ -48,3 +48,10 @@ services:
context: .
dockerfile: Bailun.DC.SkuDailyPurchaseAndSales/Dockerfile
bailun.dc.happenamount:
image: ${DOCKER_REGISTRY}bailundchappenamount
build:
context: .
dockerfile: Bailun.DC.HappenAmount/Dockerfile
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