/// <summary> /// 設置欄位值 /// </summary> /// <param name="set"></param> /// <param name="action"></param> public static void SetData(ReceiptBillSet set, ApplicationDbContext dataAccess, Dictionary <string, BizCustomerSet> bizCustSetDic, Dictionary <string, CollectionTypeSet> colSetDic, Dictionary <DateTime, bool> workDic) { BizCustomerSet bizCustomerSet = GetBizCustomerSet(dataAccess, bizCustSetDic, set.ReceiptBill.VirtualAccountCode); CollectionTypeSet collectionTypeSet = GetCollectionTypeSet(dataAccess, colSetDic, set.ReceiptBill.CollectionTypeId); SetBizCustomer(set.ReceiptBill, bizCustomerSet.BizCustomer); SetBillNo(dataAccess, set.ReceiptBill); SetFee(set.ReceiptBill, bizCustomerSet, collectionTypeSet); SetRemitDate(set.ReceiptBill, collectionTypeSet, workDic); SetErrMessage(set.ReceiptBill); }
/// <summary> /// /// </summary> /// <param name="modelSources"></param> void IImportData.CreateData(IList modelSources) { List <ReceiptInfoBillBankModel> models = modelSources as List <ReceiptInfoBillBankModel>; using ReceiptBillRepository billRepo = new ReceiptBillRepository(DataAccess) { Message = Message, User = SystemOperator.SysOperator }; models.ForEach(model => { ReceiptBillSet set = BizReceiptInfo.GetReceiptBillSet(model); billRepo.Create(set); }); billRepo.CommitData(FuncAction.Create); }
//超商-產險 public static ReceiptBillSet GetReceiptBillSet(ReceiptInfoBillMarketSPIModel model, List <ChannelMapModel> channelMap) { ReceiptBillSet result = new ReceiptBillSet() { ReceiptBill = new ReceiptBillModel() { BillNo = "", CollectionTypeId = model.CollectionType.Trim(), ChannelId = channelMap.FirstOrDefault(p => p.TransCode.Equals(model.Channel.Trim()))?.ChannelId, TransDate = model.TransDate.ToDateTime(), TradeDate = model.PayDate.ToDateTime(), PayAmount = model.Barcode3_Amount.ToDecimal(), VirtualAccountCode = model.Barcode2, ImportBatchNo = model.ImportBatchNo, Source = model.Source, } }; return(result); }
//郵局 public static ReceiptBillSet GetReceiptBillSet(ReceiptInfoBillPostModel model, List <ChannelMapModel> channelMap) { ReceiptBillSet result = new ReceiptBillSet() { ReceiptBill = new ReceiptBillModel() { BillNo = "", CollectionTypeId = model.CollectionType.Trim().Trim(), ChannelId = channelMap.FirstOrDefault(p => p.TransCode.Equals(model.Channel))?.ChannelId, TransDate = model.TradeDate.ROCDateToCEDate().AddDays(1), TradeDate = model.TradeDate.ROCDateToCEDate(), PayAmount = model.Amount.ToDecimal(), VirtualAccountCode = model.CompareCode, ImportBatchNo = model.ImportBatchNo, Source = model.Source, } }; return(result); }
//銀行 public static ReceiptBillSet GetReceiptBillSet(ReceiptInfoBillBankModel model) { DateTime.TryParse($"{model.TradeDate.ToADDateFormat()} {model.TradeTime.Substring(0, 2)}:{model.TradeTime.Substring(2, 2)}:{model.TradeTime.Substring(4, 2)}", out DateTime tradeDate); ReceiptBillSet result = new ReceiptBillSet() { ReceiptBill = new ReceiptBillModel() { BillNo = "", CollectionTypeId = SystemCP.BankCollectionTypeId, ChannelId = model.Channel, TransDate = tradeDate, TradeDate = tradeDate, ExpectRemitDate = tradeDate, PayAmount = model.Amount.ToDecimal(), VirtualAccountCode = model.CompareCode, ImportBatchNo = model.ImportBatchNo, Source = model.Source, } }; return(result); }
/// <summary> /// 過帳通路電子帳簿 /// </summary> private static void PostingChannelEAccount(ApplicationDbContext dataAccess, IUserModel user, ReceiptBillSet set) { if (set.ReceiptBill.ExpectRemitDate.Equals(DateTime.MinValue)) { return; } using ChannelEAccountBillRepository repo = new ChannelEAccountBillRepository(dataAccess) { User = user }; ChannelEAccountBillModel channelEAccount = dataAccess.Set <ChannelEAccountBillModel>().FirstOrDefault(p => p.ChannelId.Equals(set.ReceiptBill.ChannelId) && p.CollectionTypeId.Equals(set.ReceiptBill.CollectionTypeId) && p.ExpectRemitDate.Equals(set.ReceiptBill.ExpectRemitDate)); if (null == channelEAccount) { channelEAccount = dataAccess.Set <ChannelEAccountBillModel>().Local.FirstOrDefault(p => p.ChannelId.Equals(set.ReceiptBill.ChannelId) && p.CollectionTypeId.Equals(set.ReceiptBill.CollectionTypeId) && p.ExpectRemitDate.Equals(set.ReceiptBill.ExpectRemitDate)); } ChannelEAccountBillSet accountSet; if (null == channelEAccount) { accountSet = CreateChannelEAccountBill(set.ReceiptBill); channelEAccount = repo.Create(accountSet).ChannelEAccountBill; } accountSet = repo.QueryData(new object[] { channelEAccount.BillNo }); if (!dataAccess.Set <ChannelEAccountBillDetailModel>().Where(p => p.ReceiptBillNo.Equals(set.ReceiptBill.BillNo)).Any()) { accountSet.ChannelEAccountBillDetail.Add(new ChannelEAccountBillDetailModel() { BillNo = accountSet.ChannelEAccountBill.BillNo, ReceiptBillNo = set.ReceiptBill.BillNo, RowState = RowState.Insert }); } repo.Update(new object[] { accountSet.ChannelEAccountBill.BillNo }, accountSet); }
/// <summary> /// 過帳資料 /// </summary> public static void PostingData(ApplicationDbContext dataAccess, IUserModel user, TransStatus status, ReceiptBillSet oldData, ReceiptBillSet newData) { PostingBillReceiptDetail(dataAccess, newData.ReceiptBill); PostingChannelEAccount(dataAccess, user, newData); }