|
@ -4,9 +4,14 @@ using System.Linq; |
|
|
using System.ServiceModel.Channels; |
|
|
using System.ServiceModel.Channels; |
|
|
using System.Text; |
|
|
using System.Text; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax; |
|
|
|
|
|
using Nito.AsyncEx; |
|
|
|
|
|
using SettleAccount.Domain.BQ; |
|
|
using TaskJob.EventArgs; |
|
|
using TaskJob.EventArgs; |
|
|
using TaskJob.Interfaces; |
|
|
using TaskJob.Interfaces; |
|
|
using Volo.Abp.DependencyInjection; |
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
|
|
using Win.Sfs.SettleAccount.Constant; |
|
|
|
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
|
|
|
|
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|
@ -16,23 +21,162 @@ public class PendingDeductionService : ITransientDependency, IExportJob |
|
|
protected readonly INormalEfCoreRepository<BBAC_SEC_DETAIL, Guid> _bbacSecRepository; |
|
|
protected readonly INormalEfCoreRepository<BBAC_SEC_DETAIL, Guid> _bbacSecRepository; |
|
|
protected readonly INormalEfCoreRepository<HBPO_SEC_DETAIL, Guid> _hbpoSecRepository; |
|
|
protected readonly INormalEfCoreRepository<HBPO_SEC_DETAIL, Guid> _hbpoSecRepository; |
|
|
protected readonly INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> _pubSecRepository; |
|
|
protected readonly INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> _pubSecRepository; |
|
|
|
|
|
protected readonly INormalEfCoreRepository<BBAC_PD_DETAIL, Guid> _bbacRepository; |
|
|
|
|
|
protected readonly INormalEfCoreRepository<HBPO_PD_DETAIL, Guid> _hbpoRepository; |
|
|
|
|
|
protected readonly INormalEfCoreRepository<PUB_PD_DETAIL, Guid> _pubRepository; |
|
|
public PendingDeductionService( |
|
|
public PendingDeductionService( |
|
|
INormalEfCoreRepository<BBAC_SEC_DETAIL, Guid> bbacSecRepository, |
|
|
INormalEfCoreRepository<BBAC_SEC_DETAIL, Guid> bbacSecRepository, |
|
|
INormalEfCoreRepository<HBPO_SEC_DETAIL, Guid> hbpoSecRepository, |
|
|
INormalEfCoreRepository<HBPO_SEC_DETAIL, Guid> hbpoSecRepository, |
|
|
INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSecRepository, |
|
|
INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSecRepository, |
|
|
|
|
|
INormalEfCoreRepository<BBAC_PD_DETAIL, Guid> bbacRepository, |
|
|
|
|
|
INormalEfCoreRepository<HBPO_PD_DETAIL, Guid> hbpoRepository, |
|
|
|
|
|
INormalEfCoreRepository<PUB_PD_DETAIL, Guid> pubRepository, |
|
|
VmiAppService vimservice |
|
|
VmiAppService vimservice |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
|
|
|
_hbpoRepository = hbpoRepository; |
|
|
|
|
|
_bbacRepository= bbacRepository; |
|
|
|
|
|
_pubRepository= pubRepository; |
|
|
_bbacSecRepository = bbacSecRepository; |
|
|
_bbacSecRepository = bbacSecRepository; |
|
|
_hbpoSecRepository= hbpoSecRepository; |
|
|
_hbpoSecRepository= hbpoSecRepository; |
|
|
_pubSecRepository= pubSecRepository; |
|
|
_pubSecRepository= pubSecRepository; |
|
|
_vimservice =vimservice; |
|
|
_vimservice =vimservice; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> condition) |
|
|
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var list = property.Where(p => p.Name == "BillNumList").FirstOrDefault().Value; |
|
|
|
|
|
var type = property.Where(p => p.Name == "Type").FirstOrDefault().Value; |
|
|
|
|
|
if (type == "BBACJIS") |
|
|
|
|
|
{ |
|
|
|
|
|
var jisdetail = _bbacRepository.Where(p => list.Contains(p.BillNum) && p.IsMaiDan==false); |
|
|
|
|
|
var mdetail = _bbacRepository.Where(p => list.Contains(p.BillNum) && p.IsMaiDan ==true); |
|
|
|
|
|
var query = from itm in jisdetail |
|
|
|
|
|
join itm1 in _bbacSecRepository |
|
|
|
|
|
on new { itm.PN, itm.LU } equals new { itm1.PN,LU= itm1.PrimitiveLU } into temp1 |
|
|
|
|
|
from tm in temp1 |
|
|
|
|
|
where tm == null |
|
|
|
|
|
select |
|
|
|
|
|
new |
|
|
|
|
|
{ |
|
|
|
|
|
BillTime = DateTime.Now, |
|
|
|
|
|
ChangedTime = DateTime.Now, |
|
|
|
|
|
Qty = itm.Qty, |
|
|
|
|
|
DeliverTime = itm.CreationTime, |
|
|
|
|
|
LogType = Entities.BQ.Vmi.VmiLogType.Type200, |
|
|
|
|
|
ChangedQty = itm.Qty, |
|
|
|
|
|
ChangedType = VmiType.Out, |
|
|
|
|
|
SubBillType = EnumDeliverSubBillType.小件BBAC, |
|
|
|
|
|
BillType = EnumDeliverBjBmpBillType.JIS件, |
|
|
|
|
|
PartCode = tm!=null?tm.ReplaceLU:itm.LU, |
|
|
|
|
|
SettlementVinCode = itm.PN, |
|
|
|
|
|
PartCode2 = tm != null ? tm.ReplaceLU : itm.LU, |
|
|
|
|
|
CustomerPartCode =string.IsNullOrEmpty(itm.Extend4)?string.Empty:itm.Extend4, |
|
|
|
|
|
VinCode = itm.PN, |
|
|
|
|
|
OrderNum = itm.GroupNum, |
|
|
|
|
|
ErpToLoc = "C0001" |
|
|
|
|
|
}; |
|
|
|
|
|
var ls=query.ToList(); |
|
|
|
|
|
if (ls != null && ls.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var itm in ls) |
|
|
|
|
|
{ |
|
|
|
|
|
_vimservice.Out(Entities.BQ.Vmi.VmiLogType.Type200, "1", new Entities.BQ.Vmi.VmiLog() |
|
|
|
|
|
{ |
|
|
|
|
|
BillTime = itm.BillTime, |
|
|
|
|
|
ChangedTime = DateTime.Now, |
|
|
|
|
|
Qty = itm.Qty, |
|
|
|
|
|
DeliverTime = itm.BillTime, |
|
|
|
|
|
LogType = Entities.BQ.Vmi.VmiLogType.Type200, |
|
|
|
|
|
ChangedQty = itm.Qty, |
|
|
|
|
|
ChangedType = VmiType.Out, |
|
|
|
|
|
SubBillType = EnumDeliverSubBillType.小件BBAC, |
|
|
|
|
|
BillType = EnumDeliverBjBmpBillType.JIS件, |
|
|
|
|
|
PartCode = itm.PartCode, |
|
|
|
|
|
SettlementVinCode = itm.VinCode, |
|
|
|
|
|
PartCode2 = itm.PartCode2, |
|
|
|
|
|
CustomerPartCode = itm.CustomerPartCode, |
|
|
|
|
|
VinCode = itm.VinCode, |
|
|
|
|
|
OrderNum = itm.OrderNum, |
|
|
|
|
|
ErpToLoc = "C0001" |
|
|
|
|
|
}).ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else if (type == "HBPOJIS") |
|
|
|
|
|
{ |
|
|
|
|
|
var detailist = _hbpoRepository.Where(p => list.Contains(p.BillNum)).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
if (detailist != null && detailist.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var itm in detailist) |
|
|
|
|
|
{ |
|
|
|
|
|
_vimservice.Out(Entities.BQ.Vmi.VmiLogType.Type200, "1", new Entities.BQ.Vmi.VmiLog() |
|
|
|
|
|
{ |
|
|
|
|
|
BillTime = itm.CreationTime, |
|
|
|
|
|
ChangedTime = DateTime.Now, |
|
|
|
|
|
Qty = itm.Qty, |
|
|
|
|
|
DeliverTime = itm.CreationTime, |
|
|
|
|
|
LogType = Entities.BQ.Vmi.VmiLogType.Type200, |
|
|
|
|
|
ChangedQty = itm.Qty, |
|
|
|
|
|
ChangedType = VmiType.Out, |
|
|
|
|
|
SubBillType = EnumDeliverSubBillType.小件BBAC, |
|
|
|
|
|
BillType = EnumDeliverBjBmpBillType.JIS件, |
|
|
|
|
|
PartCode = itm.LU, |
|
|
|
|
|
SettlementVinCode = itm.PN, |
|
|
|
|
|
PartCode2 = itm.LU, |
|
|
|
|
|
CustomerPartCode = itm.LU, |
|
|
|
|
|
VinCode = itm.PN, |
|
|
|
|
|
OrderNum = itm.GroupNum, |
|
|
|
|
|
ErpToLoc = "C0001" |
|
|
|
|
|
}).ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
var detailist = _hbpoRepository.Where(p => list.Contains(p.BillNum)).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
if (detailist != null && detailist.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var itm in detailist) |
|
|
|
|
|
{ |
|
|
|
|
|
_vimservice.Out(Entities.BQ.Vmi.VmiLogType.Type200, "1", new Entities.BQ.Vmi.VmiLog() |
|
|
|
|
|
{ |
|
|
|
|
|
BillTime = itm.CreationTime, |
|
|
|
|
|
ChangedTime = DateTime.Now, |
|
|
|
|
|
Qty = itm.Qty, |
|
|
|
|
|
DeliverTime = itm.CreationTime, |
|
|
|
|
|
LogType = Entities.BQ.Vmi.VmiLogType.Type200, |
|
|
|
|
|
ChangedQty = itm.Qty, |
|
|
|
|
|
ChangedType = VmiType.Out, |
|
|
|
|
|
SubBillType = EnumDeliverSubBillType.小件BBAC, |
|
|
|
|
|
BillType = EnumDeliverBjBmpBillType.JIS件, |
|
|
|
|
|
PartCode = itm.LU, |
|
|
|
|
|
SettlementVinCode = itm.PN, |
|
|
|
|
|
PartCode2 = itm.LU, |
|
|
|
|
|
CustomerPartCode = itm.LU, |
|
|
|
|
|
VinCode = itm.PN, |
|
|
|
|
|
OrderNum = itm.GroupNum, |
|
|
|
|
|
ErpToLoc = "C0001" |
|
|
|
|
|
}).ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ApplicationConsts.SuccessStr; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return id.ToString(); |
|
|
return id.ToString(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|