From f54cbe6d070bf8d9946d949a59b73d40ac3a3cd8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com>
Date: Thu, 31 Aug 2023 16:21:32 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs | 6 +-
.../Entities/BQ/Dtos/INVOICE_GRP_DTO.cs | 7 +-
.../Bases/ADJ_SERVICE.cs | 8 --
.../Bases/CAN_SA_SERVICE.cs | 22 ++---
.../Bases/PD_SERVICE.cs | 1 +
.../Entities/BQ/BBAC_CAN_SA_SERVICE.cs | 5 +-
.../Entities/BQ/BBAC_PD_SERVICE.cs | 18 +++-
.../Entities/BQ/HBPO_CAN_SA_SERVICE.cs | 6 +-
.../Entities/BQ/HBPO_PD_SERVICE.cs | 83 ++++++-------------
.../Entities/BQ/INVOICE_SERVICE.cs | 1 +
.../Entities/BQ/PUB_CAN_SA_SERVICE.cs | 4 +-
.../Entities/BQ/PUB_PD_SERVICE.cs | 54 ++++++------
.../Entities/BQ/BBAC_CAN_SA.cs | 2 +-
.../Entities/BQ/Managers/INV_MNG.cs | 4 +-
.../src/SettleAccount.Domain/EnumBillState.cs | 3 +-
15 files changed, 105 insertions(+), 119 deletions(-)
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs
index 7cb2156e..98460a8c 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs
@@ -69,7 +69,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[ExporterHeader(DisplayName = "是否退货")] //BBAC-JIS显示 其他没有这个字段
public string IsReturn { get; set; }
- [ExporterHeader(DisplayName = "合同号")]
+ [ExporterHeader(DisplayName = "SA号")]
public string ContractDocID { set; get; }
@@ -132,8 +132,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
///
[ExporterHeader(DisplayName = "版本号")]
public int Version { get; set; }
- [ExporterHeader(DisplayName = "合同号")]
- public int ContractDocID { set; get; }
+ [ExporterHeader(DisplayName = "SA号")]
+ public string ContractDocID { set; get; }
}
//public class BBAC_CAN_SA_EXP_DTO
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
index a0f196a5..b7238e28 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
@@ -59,6 +59,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "发票税后尾差")]
public decimal TaxDiff { get; set; }
+
[Display(Name = "客户代码")]
public string ClientCode { get; set; }
}
@@ -146,7 +147,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
//[ExporterHeader(DisplayName ="发票税后尾差")]
//public decimal TaxDiff { get; set; }
- [ExporterHeader(DisplayName = "客户编码")]
+ [ExporterHeader(DisplayName = "客户代码")]
public string ClientCode { get; set; }
}
@@ -179,7 +180,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public decimal Tax { get; set; }
- [ImporterHeader(Name = "客户编码", FixAllSpace = true)]
+ [ImporterHeader(Name = "客户代码", FixAllSpace = true)]
[Required(ErrorMessage = "{0}是必填项")]
public string ClientCode { get; set; }
@@ -298,7 +299,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
///
///扩展字段1
///
- [Display(Name = "合同号")]
+ [Display(Name = "SA号")]
public string Extend1 { get; set; }
///
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs
index 8b3b088e..5d085ff5 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs
@@ -325,14 +325,6 @@ public class ADJ_SERVICE : BASE_SERVICE
ls = inner.ToList();
}
-
-
-
-
-
-
-
-
return new JsonResult(new { Code = 200, data =ls }); ;
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
index 562d930f..98b1cc9b 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
@@ -127,18 +127,18 @@ namespace Win.Sfs.SettleAccount.Bases
);
return _fileName;
}
- ///
- /// 生成发票
- ///
- /// 主表查询条件
- ///
- [HttpPost]
- //[Route("generateinvoice")]
- public virtual async Task GenerateInvoice([FromBody] string input)
- {
+ /////
+ ///// 生成发票
+ /////
+ ///// 主表查询条件
+ /////
+ //[HttpPost]
+ ////[Route("generateinvoice")]
+ //public virtual async Task GenerateInvoice([FromBody] string input)
+ //{
- return new JsonResult(new { Code = 200, Message = "创建成功" }); ;
- }
+ // return new JsonResult(new { Code = 200, Message = "创建成功" }); ;
+ //}
///
/// 查询主表
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
index 90b38257..2d20047e 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
@@ -79,6 +79,7 @@ namespace Win.Sfs.SettleAccount.Bases
_hbpoSecRepository=hbpoSecRepository;
}
+
///
/// 查询明细
///
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
index f3dc4dfc..00663f23 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
@@ -75,15 +75,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_priceRepository = priceRepository;
}
-
+
///
/// 生成发票
///
///
///
+
[HttpPost]
[UnitOfWork(false)]
- public async override Task GenerateInvoice([FromBody] string invbillNum)
+ public async Task GenerateInvoice([FromBody] string invbillNum)
{
var main =await _bbacMng.GetMainAsync(invbillNum);
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
index 9e1a71f6..cbb2456a 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
@@ -21,6 +21,8 @@ using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.Shared.RepositoryBase;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Volo.Abp.Uow;
+using Volo.Abp;
+using EFCore.BulkExtensions;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
@@ -44,18 +46,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
_service = service;
}
-
+ [UnitOfWork(false)]
public override async Task ApprovalPassed(List p_list)
{
+
var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList();
List customConditionList = new List();
customConditionList.Add(new CustomCondition() { Name = "BillNumList", Value =string.Join(",",p_list) });
customConditionList.Add(new CustomCondition() { Name = "Type", Value = EnumBusinessType.JisBBAC.ToString() });
customConditionList.Add(new CustomCondition() { Name = "IsOut", Value ="out"});
+ var ls = _repository.Where(p => p_list.Contains(p.BillNum)).ToList();
+ var lst = ls.Where(p => (p.State == SettleBillState.已提交扣减 || p.State == SettleBillState.已扣减));
+ if (lst.Count() > 0)
+ {
+ throw new UserFriendlyException("当前状态是已提交状态,不能重复已提交");
+ }
+ foreach (var item in ls)
+ {
+ item.State = SettleBillState.已提交扣减;
+ }
+ await _repository.DbContext.BulkUpdateAsync(ls);
var _taskid = await _service.ExportEnqueueAsync("BBAC待扣减任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(PendingDeductionService), customConditionList, (rs) =>
{
});
+
return _taskid;
+
}
}
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
index 5cdb5201..c0defb0d 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
@@ -74,11 +74,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
///
///
///
- [UnitOfWork(false)]
+
[HttpPost]
-
+ [UnitOfWork(false)]
//[Route("generateinvoice")]
- public async override Task GenerateInvoice([FromBody] string invbillnum)
+ public async Task GenerateInvoice([FromBody] string invbillnum)
{
var main =await _hbpoMng.GetMainAsync(invbillnum);
if (main != null)
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_PD_SERVICE.cs
index b891a1a2..b29a8dc5 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_PD_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_PD_SERVICE.cs
@@ -1,8 +1,10 @@
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Drawing.Charts;
+using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using SettleAccount.Domain.BQ;
+using SettleAccount.Job.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -10,7 +12,9 @@ using System.Text;
using System.Threading.Tasks;
using TaskJob.EventArgs;
using TaskJob.Services;
+using Volo.Abp;
using Volo.Abp.Application.Services;
+using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
@@ -20,6 +24,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos.SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
+using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
@@ -29,73 +34,37 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
HBPO_PD_DETAIL, HBPO_PD_DETAIL_DTO, HBPO_PD_REQ_DTO,
HBPO_PD_DETAIL_REQ_DTO, HBPO_PD_DETAIL_EXP_DTO>
{
- public HBPO_PD_SERVICE(INormalEfCoreRepository bbacSecRepository, INormalEfCoreRepository hbpoSecRepository, INormalEfCoreRepository pubSecRepository, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository repository, VmiAppService vimservice, INormalEfCoreRepository detailRepository) : base(bbacSecRepository, hbpoSecRepository, pubSecRepository, excelImportService, snowflakeIdGenerator, commonManager, repository, vimservice, detailRepository)
+ private readonly TaskJobService _service;
+ public HBPO_PD_SERVICE(INormalEfCoreRepository bbacSecRepository, INormalEfCoreRepository hbpoSecRepository, INormalEfCoreRepository pubSecRepository, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository repository, VmiAppService vimservice, INormalEfCoreRepository detailRepository, TaskJobService service) : base(bbacSecRepository, hbpoSecRepository, pubSecRepository, excelImportService, snowflakeIdGenerator, commonManager, repository, vimservice, detailRepository)
{
+ _service = service;
}
- //public HBPO_PD_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository repository, INormalEfCoreRepository detailRepository) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository)
- //{
- // //List customConditionList = new List();
- // //customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty });
- // //customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty });
- // //customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? string.Empty });
- // //customConditionList.Add(new CustomCondition() { Name = "Period", Value = period ?? string.Empty });
- // //customConditionList.Add(new CustomCondition() { Name = "Factory", Value = factory ?? string.Empty });
- // //var _versionQuery = _versionRepository.Where(p => p.Version == version);
- // //if (_versionQuery.Count() > 0)
- // //{
- // // _versionQuery.BatchDelete();
- // //}
-
- // //var _query = _repository.Where(p => p.Version == version);
- // //if (_query.Count() > 0)
- // //{
- // // await _query.BatchDeleteAsync();
- // //}
- // //var _taskid = await _service.ImportEnqueueAsync(files, "结算数据", CurrentUser, typeof(SettleAccountImportService), customConditionList, (rs) =>
- // //{
-
-
-
-
- // //});
-
-
-
- //}
-
-
+ [UnitOfWork(false)]
public override async Task ApprovalPassed(List p_list)
{
var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList();
- if (detailist != null && detailist.Count > 0)
+ List customConditionList = new List();
+ customConditionList.Add(new CustomCondition() { Name = "BillNumList", Value = string.Join(",", p_list) });
+ customConditionList.Add(new CustomCondition() { Name = "Type", Value = EnumBusinessType.JisHBPO.ToString() });
+ customConditionList.Add(new CustomCondition() { Name = "IsOut", Value = "out" });
+ var ls = _repository.Where(p => p_list.Contains(p.BillNum)).ToList();
+ var lst = ls.Where(p => (p.State == SettleBillState.已提交扣减 || p.State == SettleBillState.已扣减));
+ if (lst.Count() > 0)
{
- foreach (var itm in detailist)
- {
- await _vimservice.Out(Entities.BQ.Vmi.VmiLogType.Type200, "1", new Entities.BQ.Vmi.VmiLog()
- {
- BillTime = itm.CreationTime,
- ChangedTime = DateTime.Now,
- Qty = itm.Qty,
- AssembleData = itm.CreationTime,
- LogType = Entities.BQ.Vmi.VmiLogType.Type200,
- ChangedQty = itm.Qty,
- ChangedType = VmiType.Out,
- DeliverSubBillType = EnumDeliverSubBillType.小件BBAC,
- DeliverBillType = EnumDeliverBjBmpBillType.JIS件,
- RealPartCode = itm.LU,
- SettlementVinCode = itm.PN,
- //PartCode2 = itm.LU,
- CustPartCode = itm.LU,
- VinCode = itm.PN,
- OrderNum = itm.GroupNum,
- ErpToLoc = "C0001"
- });
- }
+ throw new UserFriendlyException("当前状态是已提交状态,不能重复已提交");
}
- return ApplicationConsts.SuccessStr;
+ foreach (var item in ls)
+ {
+ item.State = SettleBillState.已提交扣减;
+ }
+ await _repository.DbContext.BulkUpdateAsync(ls);
+ var _taskid = await _service.ExportEnqueueAsync("HBPO待扣减任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(PendingDeductionService), customConditionList, (rs) =>
+ {
+ });
+ return _taskid;
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
index b3e8445e..2cdeb8ec 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
@@ -378,6 +378,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
inv.RealnvBillNum = newinv.RealnvBillNum;
inv.RealAmt = newinv.RealAmt;
inv.TaxDiff = inv.TaxAmt-newinv.RealAmt;
+ inv.ClientCode = newinv.ClientCode;
}
foreach (var detail in invdetail)
{
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
index e509b0f3..c9f803a0 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
@@ -10,6 +10,7 @@ using SettleAccount.Domain.BQ;
using Volo.Abp;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
+using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
@@ -66,7 +67,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_pricebjRepository = pricebjRepository;
}
[HttpPost]
- public async override Task GenerateInvoice( [FromBody] string billnum)
+ [UnitOfWork(false)]
+ public async Task GenerateInvoice( [FromBody] string billnum)
{
var main = await _pubMng.GetMainAsync(billnum);
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_PD_SERVICE.cs
index 649139de..2dc6af46 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_PD_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_PD_SERVICE.cs
@@ -1,12 +1,17 @@
+using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using SettleAccount.Domain.BQ;
+using SettleAccount.Job.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using TaskJob.EventArgs;
+using Volo.Abp;
using Volo.Abp.Application.Services;
+using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
@@ -16,6 +21,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos.SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
+using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@@ -26,39 +32,35 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
PUB_PD_DETAIL, PUB_PD_DETAIL_DTO, PUB_PD_REQ_DTO,
PUB_PD_DETAIL_REQ_DTO, PUB_PD_DETAIL_EXP_DTO>
{
- public PUB_PD_SERVICE(INormalEfCoreRepository bbacSecRepository, INormalEfCoreRepository hbpoSecRepository, INormalEfCoreRepository pubSecRepository, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository repository, VmiAppService vimservice, INormalEfCoreRepository detailRepository) : base(bbacSecRepository, hbpoSecRepository, pubSecRepository, excelImportService, snowflakeIdGenerator, commonManager, repository, vimservice, detailRepository)
+ private readonly TaskJobService _service;
+ public PUB_PD_SERVICE(INormalEfCoreRepository bbacSecRepository, INormalEfCoreRepository hbpoSecRepository, INormalEfCoreRepository pubSecRepository, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository repository, VmiAppService vimservice, INormalEfCoreRepository detailRepository, TaskJobService service) : base(bbacSecRepository, hbpoSecRepository, pubSecRepository, excelImportService, snowflakeIdGenerator, commonManager, repository, vimservice, detailRepository)
{
+ _service=service;
}
-
+ [UnitOfWork(false)]
public override async Task ApprovalPassed(List p_list)
{
var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList();
- if (detailist != null && detailist.Count > 0)
+ List customConditionList = new List();
+ customConditionList.Add(new CustomCondition() { Name = "BillNumList", Value = string.Join(",", p_list) });
+ customConditionList.Add(new CustomCondition() { Name = "Type", Value = "PUB" });
+ customConditionList.Add(new CustomCondition() { Name = "IsOut", Value = "out" });
+ var ls = _repository.Where(p => p_list.Contains(p.BillNum)).ToList();
+ var lst = ls.Where(p => (p.State == SettleBillState.已提交扣减 || p.State == SettleBillState.已扣减));
+ if (lst.Count() > 0)
+ {
+ throw new UserFriendlyException("当前状态是已提交状态,不能重复已提交");
+ }
+ foreach (var item in ls)
{
- foreach (var itm in detailist)
- {
- await _vimservice.Out(Entities.BQ.Vmi.VmiLogType.Type200, "1", new Entities.BQ.Vmi.VmiLog()
- {
- BillTime = itm.CreationTime,
- ChangedTime = DateTime.Now,
- Qty = itm.Qty,
- AssembleData = itm.CreationTime,
- LogType = Entities.BQ.Vmi.VmiLogType.Type200,
- ChangedQty = itm.Qty,
- ChangedType = VmiType.Out,
- DeliverSubBillType = EnumDeliverSubBillType.小件BBAC,
- DeliverBillType = EnumDeliverBjBmpBillType.JIS件,
- RealPartCode = itm.LU,
- SettlementVinCode = itm.PN,
- //PartCode2 = itm.LU,
- CustPartCode = itm.LU,
- VinCode = itm.PN,
- OrderNum = itm.GroupNum,
- ErpToLoc = "C0001"
- });
- }
+ item.State = SettleBillState.已提交扣减;
}
- return ApplicationConsts.SuccessStr;
+ await _repository.DbContext.BulkInsertAsync(ls);
+ var _taskid = await _service.ExportEnqueueAsync("BBAC待扣减任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(PendingDeductionService), customConditionList, (rs) =>
+ {
+ });
+
+ return _taskid;
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
index 59464db8..c5274dc2 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
@@ -109,7 +109,7 @@ public class BBAC_CAN_SA_DETAIL: SA_CAN_BASE
public bool IsReturn { get; set; } =false;
- [Display(Name="合同号")]
+ [Display(Name="SA")]
public string ContractDocID { get; set; }
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
index 7e98f5c5..aa35e45b 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
@@ -1190,7 +1190,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
bussiessType: businessType,
amt: detail.Amt,
pRICE: detail.Price,
- extend1: string.Empty,
+ extend1: detail.ContractDocID,
extend2: string.Empty,
beginDate: detail.BeginDate,
endDate: detail.EndDate,
@@ -1394,7 +1394,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
bussiessType: businessType,
amt: detail.Amt,
pRICE: detail.Price,
- extend1: string.Empty,
+ extend1: detail.ContactDocID,
extend2: string.Empty,
beginDate: detail.BeginDate,
endDate: detail.EndDate,
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs
index 5c527381..45ba3486 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs
@@ -30,7 +30,8 @@ namespace Win.Sfs.SettleAccount
已扣减 = 5,
[Description("客户已收票")]
客户已收票 = 4,
-
+ [Description("已提交扣减")]
+ 已提交扣减 = 6
}
public enum InvoiceBillState