Commit fd8fd153 by guanzhenshan

增加生成每日借支单待还金额服务

parent f2eb78c7
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.35" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.5" />
<PackageReference Include="MySql.Data" Version="8.0.20" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bailun.DC.Common\Bailun.DC.Common.csproj" />
</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.DailyBorrowFee/Bailun.DC.DailyBorrowFee.csproj Bailun.DC.DailyBorrowFee/
COPY Bailun.DC.Common/Bailun.DC.Common.csproj Bailun.DC.Common/
RUN dotnet restore Bailun.DC.DailyBorrowFee/Bailun.DC.DailyBorrowFee.csproj
COPY . .
WORKDIR /src/Bailun.DC.DailyBorrowFee
RUN dotnet build Bailun.DC.DailyBorrowFee.csproj -c Release -o /app
FROM build AS publish
RUN dotnet publish Bailun.DC.DailyBorrowFee.csproj -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Bailun.DC.DailyBorrowFee.dll"]
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Threading.Tasks;
namespace Bailun.DC.DailyBorrowFee
{
class Program
{
/// <summary>
/// 每日借支单
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
//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.Now;
start = DateTime.Parse(start.AddDays(-1).ToShortDateString());
_services.Init(start);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
using Dapper;
using Microsoft.Extensions.Hosting;
using System.Threading;
using System.Threading.Tasks;
namespace Bailun.DC.DailyBorrowFee
{
public class Services : BackgroundService
{
private Timer _timer;
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
_timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromMinutes(1));
return Task.CompletedTask;
}
private void DoWork(object state)
{
try
{
var now = DateTime.Now;
if (now.Hour == 0 && now.Minute == 01) //凌晨0:01分启动
{
Console.WriteLine("开始启动 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
var start = DateTime.Parse(now.AddDays(-1).ToShortDateString());
Init(start);
Console.WriteLine("任务运行完成 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
public void Init(DateTime day)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
cn.Execute("delete from dc_daily_fee where recoed_time='" + day.ToString("yyyy-MM-dd") + "'");
var sql = $@"insert dc_daily_fee(cost_plan_no, cost_no, cost_reason, cost_form, company_no, company_name, type_no,
type_name, kind_no, kind_name, create_userid, create_usercode, create_username,
cost_remark, create_time, cost_status, file_path, mor_file_path, amount, bank_name,
bank_card, bank_card_user, bank_company, mor_remark, son_cost_no, sup_cost_no,
is_lend, had_pay, lend_status, compensate, counteract, lend_balance, reject_reason,
dic, pay_counteract, pay_lend_balance, pay_plan_amount, pay_dic, pay_cur, is_tax,
detail_key, pay_user_id, pay_time, amount_rmb, to_rmb_rate, sub_logistics_supplier_id,
logistics_supplier_id, subject_code, company_value, audit_time, last_modify_date,
bj_create, bj_modified, recoed_time)
select cost_plan_no, cost_no, cost_reason, cost_form, company_no, company_name, type_no,
type_name, kind_no, kind_name, create_userid, create_usercode, create_username,
cost_remark, create_time, cost_status, file_path, mor_file_path, amount, bank_name,
bank_card, bank_card_user, bank_company, mor_remark, son_cost_no, sup_cost_no,
is_lend, had_pay, lend_status, compensate, counteract, lend_balance, reject_reason,
dic, pay_counteract, pay_lend_balance, pay_plan_amount, pay_dic, pay_cur, is_tax,
detail_key, pay_user_id, pay_time, amount_rmb, to_rmb_rate, sub_logistics_supplier_id,
logistics_supplier_id, subject_code, company_value, audit_time, last_modify_date,
bj_create, bj_modified, '{day.ToString("yyyy-MM-dd")}' from dc_base_finance_fee where is_lend = 1 and cost_form = 3 and lend_status in (1, 2)";
cn.Execute(sql);
}
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.35" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.5" />
<PackageReference Include="MySql.Data" Version="8.0.20" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bailun.DC.Common\Bailun.DC.Common.csproj" />
</ItemGroup>
</Project>
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.SyncLogisticInfo.Models
{
public class dc_base_logistics
{
public int id { get; set; }
public int wms_id { get; set; }
public string company_code { get; set; }
public string company_name { get; set; }
public string bill_code { get; set; }
public string tracking_no { get; set; }
public decimal merchant_output_weight_kg { get; set; }
public decimal merchant_shipment_cost_cny { get; set; }
public DateTime? merchant_reconciliation_time { get; set; }
public string reconciliation_type { get; set; }
public string info_id { get; set; }
public decimal output_weight_kg { get; set; }
public decimal bailun_shipment_cost_cny { get; set; }
public DateTime? shipment_time { get; set; }
public string diff_state_type { get; set; }
public decimal merchant_output_weight_kg_original { get; set; }
public decimal merchant_shipment_cost_sny_original { get; set; }
public decimal cost_diff_decimal { get; set; }
public decimal weight_diff_decimal { get; set; }
public string line_name { get; set; }
public string fee_code { get; set; }
public string remark { get; set; }
public string generate_bill_status { get; set; }
public string fee_product_type { get; set; }
public DateTime? last_modification_time { get; set; }
public DateTime gmt_create_time { get; set; }
public DateTime gmt_modify_time { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.SyncLogisticInfo.Models
{
public class mResult
{
public mResult_Request result { get; set; }
public string targetUrl { get; set; }
public bool success { get; set; }
public string error { get; set; }
public bool unAuthorizedRequest { get; set; }
}
public class mResult_Request
{
public List<DataInfo> result { get; set; }
public int pageIndex { get; set; }
public int totalPages { get; set; }
public int total { get; set; }
public bool hasPreViousPage { get; set; }
public bool hasNextPage { get; set; }
}
public class DataInfo
{
public int id { get; set; }
public string company_Code { get; set; }
public string company_Name { get; set; }
public string billCode { get; set; }
public string trackingNo { get; set; }
public decimal merchantOutputWeightKg { get; set; }
public decimal merchantShipmentCostCNY { get; set; }
public DateTime merchantReconciliationTime { get; set; }
public string reconciliationType { get; set; }
public int infoId { get; set; }
public decimal outputWeightKg { get; set; }
public decimal bailunShipmentCostCNY { get; set; }
public DateTime? shipmentTime { get; set; }
public int diffStateType { get; set; }
public decimal? merchantOutputWeightKg_Original { get; set; }
public decimal? merchantShipmentCostCNY_Original { get; set; }
public decimal costDiffDecimal { get; set; }
public decimal weightDiffDecimal { get; set; }
public string line_Name { get; set; }
public string feeCode { get; set; }
public string remark { get; set; }
public string generateBillStatus { get; set; }
public string feeProductType { get; set; }
public DateTime lastModificationTime { get; set; }
}
}
using System;
namespace Bailun.DC.SyncLogisticInfo
{
class Program
{
/// <summary>
/// 同步物流对账基础数据
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.SyncLogisticInfo
{
public class Services
{
string url = "http://wms.bailuntec.com/api/services/app/LogisticsReconciliationService/GetNormalDataQuery";
public void Init()
{
}
private void Save()
{
}
}
}
......@@ -53,6 +53,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bailun.DC.DailyPlatformAcco
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bailun.DC.AllotOrderDetail", "Bailun.DC.AllotOrderDetail\Bailun.DC.AllotOrderDetail.csproj", "{9FE5546F-871B-4A06-90A3-2B1567EA3E26}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bailun.DC.SyncLogisticInfo", "Bailun.DC.SyncLogisticInfo\Bailun.DC.SyncLogisticInfo.csproj", "{70BEDA08-20D6-4EDF-8653-72595618E3CE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bailun.DC.DailyBorrowFee", "Bailun.DC.DailyBorrowFee\Bailun.DC.DailyBorrowFee.csproj", "{BABF8256-64D9-42F4-8008-B8AC51F3692E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -155,6 +159,14 @@ Global
{9FE5546F-871B-4A06-90A3-2B1567EA3E26}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9FE5546F-871B-4A06-90A3-2B1567EA3E26}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9FE5546F-871B-4A06-90A3-2B1567EA3E26}.Release|Any CPU.Build.0 = Release|Any CPU
{70BEDA08-20D6-4EDF-8653-72595618E3CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70BEDA08-20D6-4EDF-8653-72595618E3CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70BEDA08-20D6-4EDF-8653-72595618E3CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70BEDA08-20D6-4EDF-8653-72595618E3CE}.Release|Any CPU.Build.0 = Release|Any CPU
{BABF8256-64D9-42F4-8008-B8AC51F3692E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BABF8256-64D9-42F4-8008-B8AC51F3692E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BABF8256-64D9-42F4-8008-B8AC51F3692E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BABF8256-64D9-42F4-8008-B8AC51F3692E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -178,6 +190,8 @@ Global
{A8E6DCD5-9F45-41D3-9297-FB104772B11C} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{7EA89BAB-0D45-4959-8AB2-9F08FDB3D7F9} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{9FE5546F-871B-4A06-90A3-2B1567EA3E26} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{70BEDA08-20D6-4EDF-8653-72595618E3CE} = {AE2CE86A-8538-4142-920F-684DCF47C064}
{BABF8256-64D9-42F4-8008-B8AC51F3692E} = {AE2CE86A-8538-4142-920F-684DCF47C064}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6E53AF28-A282-4FB0-A769-EAEA9769C02A}
......
......@@ -125,3 +125,10 @@ services:
context: .
dockerfile: ../Bailun.DC.AllotOrderDetail/Dockerfile
bailun.dc.dailyborrowfee:
image: ${DOCKER_REGISTRY}bailundcdailyborrowfee
build:
context: .
dockerfile: Bailun.DC.DailyBorrowFee/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