|
|
@ -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<BBAC_SEC_DETAIL, Guid> bbacSecRepository, INormalEfCoreRepository<HBPO_SEC_DETAIL, Guid> hbpoSecRepository, INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSecRepository, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository<HBPO_PD, Guid> repository, VmiAppService vimservice, INormalEfCoreRepository<HBPO_PD_DETAIL, Guid> detailRepository) : base(bbacSecRepository, hbpoSecRepository, pubSecRepository, excelImportService, snowflakeIdGenerator, commonManager, repository, vimservice, detailRepository) |
|
|
|
private readonly TaskJobService _service; |
|
|
|
public HBPO_PD_SERVICE(INormalEfCoreRepository<BBAC_SEC_DETAIL, Guid> bbacSecRepository, INormalEfCoreRepository<HBPO_SEC_DETAIL, Guid> hbpoSecRepository, INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSecRepository, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository<HBPO_PD, Guid> repository, VmiAppService vimservice, INormalEfCoreRepository<HBPO_PD_DETAIL, Guid> 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<HBPO_PD, Guid> repository, INormalEfCoreRepository<HBPO_PD_DETAIL, Guid> detailRepository) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository)
|
|
|
|
//{
|
|
|
|
// //List<CustomCondition> customConditionList = new List<CustomCondition>();
|
|
|
|
// //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<ImportTaskArgs>(files, "结算数据", CurrentUser, typeof(SettleAccountImportService), customConditionList, (rs) =>
|
|
|
|
// //{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
[UnitOfWork(false)] |
|
|
|
public override async Task<string> ApprovalPassed(List<string> p_list) |
|
|
|
{ |
|
|
|
var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList(); |
|
|
|
if (detailist != null && detailist.Count > 0) |
|
|
|
List<CustomCondition> customConditionList = new List<CustomCondition>(); |
|
|
|
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) |
|
|
|
throw new UserFriendlyException("当前状态是已提交状态,不能重复已提交"); |
|
|
|
} |
|
|
|
foreach (var item in ls) |
|
|
|
{ |
|
|
|
await _vimservice.Out(Entities.BQ.Vmi.VmiLogType.Type200, "1", new Entities.BQ.Vmi.VmiLog() |
|
|
|
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) => |
|
|
|
{ |
|
|
|
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" |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
return ApplicationConsts.SuccessStr; |
|
|
|
|
|
|
|
return _taskid; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|