diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs index f2bb45e3..d06d4edb 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs @@ -106,32 +106,61 @@ public class JitSeSyncAppService : ApplicationService, IInvocable await _syncPositionFlagRepository.InsertAsync(syncPositionFlag); } - pubSeDetails.ForEach(pubSeDetail => + foreach (var pubSeDetail in pubSeDetails) { - var vmiBalance = new VmiBalance() + if (pubSeDetail.TransType == EnumDelTransType.发货) { - PartCode = pubSeDetail.PartCode, - VinCode = pubSeDetail.PN, - CustomerPartCode = default, - CodeType = default, - BillType = pubSeDetail.DeliverBillType, - Qty = pubSeDetail.Qty, - BillTime = pubSeDetail.BillTime, - DeliverTime = pubSeDetail.DnBillTime, - ErpToLoc = pubSeDetail.ToErpLocCode, - Seq = default, - OrderNum = pubSeDetail.DnBillNum, - UniqueCode = default, - MatchNumber = default, - PjsNum = default, - Configcode = default, - factory = default, - SubBillType = pubSeDetail.DeliverSubBillType, - RealCode = default, - ReMark = pubSeDetail.Remark, - }; - _vmiService.In(logType: Vmi.VmiLogType.Type100, changedNumber: pubSeDetail.DnBillNum, data: vmiBalance); - }); + var vmiBalance = new VmiBalance() + { + PartCode = pubSeDetail.PartCode, + VinCode = pubSeDetail.PN, + CustomerPartCode = default, + CodeType = default, + BillType = pubSeDetail.DeliverBillType, + Qty = pubSeDetail.Qty, + BillTime = pubSeDetail.BillTime, + DeliverTime = pubSeDetail.DnBillTime, + ErpToLoc = pubSeDetail.ToErpLocCode, + Seq = default, + OrderNum = pubSeDetail.DnBillNum, + UniqueCode = default, + MatchNumber = default, + PjsNum = default, + Configcode = default, + factory = default, + SubBillType = pubSeDetail.DeliverSubBillType, + RealCode = default, + ReMark = pubSeDetail.Remark, + }; + await _vmiService.In(logType: Vmi.VmiLogType.Type100, changedNumber: pubSeDetail.DnBillNum, data: vmiBalance); + } + else if (pubSeDetail.TransType == EnumDelTransType.退货) + { + var vmiLog = new VmiLog() + { + PartCode = pubSeDetail.PartCode, + VinCode = pubSeDetail.PN, + CustomerPartCode = default, + CodeType = default, + BillType = pubSeDetail.DeliverBillType, + Qty = pubSeDetail.Qty, + BillTime = pubSeDetail.BillTime, + DeliverTime = pubSeDetail.DnBillTime, + ErpToLoc = pubSeDetail.ToErpLocCode, + Seq = default, + OrderNum = pubSeDetail.DnBillNum, + UniqueCode = default, + MatchNumber = default, + PjsNum = default, + Configcode = default, + factory = default, + SubBillType = pubSeDetail.DeliverSubBillType, + RealCode = default, + ReMark = pubSeDetail.Remark, + }; + await _vmiService.Out(VmiLogType.Type400, pubSeDetail.DnBillNum, vmiLog); + } + } } } }