This commit is contained in:
2025-06-17 09:32:06 +08:00
parent 2202cf0605
commit 7828dcc618
14 changed files with 1204 additions and 61 deletions

View File

@@ -1,4 +1,5 @@
using MyCode.Project.Domain.Message.Act.PurchaseOrder;
using MyCode.Project.Domain.Message.Act.InvoiceOrder;
using MyCode.Project.Domain.Message.Act.PurchaseOrder;
using MyCode.Project.Domain.Message.Common;
using MyCode.Project.Domain.Message.Request.InvoiceOrder;
using MyCode.Project.Domain.Message.Response.InvoiceOrder;
@@ -43,5 +44,12 @@ namespace MyCode.Project.Services
/// <param name="act"></param>
/// <returns></returns>
TiaoMaResp SetBaoShuTiaoMa(TiaoMaAct act);
/// <summary>
/// 修改发票日期和发票号
/// </summary>
/// <param name="act"></param>
void BatchSetFaPiao(FaPiaoAct act);
}
}

View File

@@ -1,4 +1,5 @@
using Kingdee.CDP.WebApi.SDK;
using MyCode.Project.Domain.Message.Act.InvoiceOrder;
using MyCode.Project.Domain.Message.Act.PurchaseOrder;
using MyCode.Project.Domain.Message.Common;
using MyCode.Project.Domain.Message.Request.InvoiceOrder;
@@ -21,6 +22,7 @@ using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
namespace MyCode.Project.Services.Implementation
{
@@ -377,6 +379,69 @@ namespace MyCode.Project.Services.Implementation
}
#endregion
#region BatchSetFaPiao()
/// <summary>
/// 修改发票日期和发票号
/// </summary>
/// <param name="act"></param>
public void BatchSetFaPiao(FaPiaoAct act )
{
var ids = act.Ids;
var InvoiceOrderIds = _invoiceOrderItemRepository.Queryable().Where(t => ids.Contains(t.Id)).Select(t => t.InvoiceOrderId).ToList().Distinct().ToList();
var orderList = _invoiceOrderRepository.Queryable().Where(t => InvoiceOrderIds.Contains(t.Id)).ToList();
orderList.ForEach(t =>
{
SetFaPiaoAct setFaPiaoAct = new SetFaPiaoAct();
setFaPiaoAct.NeedUpDateFields = new List<string>();
setFaPiaoAct.Fid = t.FiD.Value;
if (!string.IsNullOrWhiteSpace(act.F_URXD_Date))
{
t.F_URXD_Date = act.F_URXD_Date;
setFaPiaoAct.F_URXD_Date= act.F_URXD_Date;
setFaPiaoAct.NeedUpDateFields.Add("F_URXD_Date");
}
if (!string.IsNullOrWhiteSpace(act.F_VHUB_Text))
{
t.F_VHUB_Text = act.F_VHUB_Text;
setFaPiaoAct.F_VHUB_Text = act.F_VHUB_Text;
setFaPiaoAct.NeedUpDateFields.Add("F_VHUB_Text");
}
if (setFaPiaoAct.NeedUpDateFields.Count>0)
SetFaPiao(setFaPiaoAct);
Thread.Sleep(300);
});
_invoiceOrderRepository.Update(orderList);
}
public void SetFaPiao(SetFaPiaoAct act)
{
string FormId = "PUR_ReceiveBill";
BillSave bill = new BillSave();
bill.NeedUpDateFields = new List<string>();
bill.NeedUpDateFields.AddRange(act.NeedUpDateFields);
//bill.NeedUpDateFields.Add("FPOOrderEntry");
//bill.NeedUpDateFields.Add("FSupDueDate");
bill.NeedReturnFields = new List<string>();
bill.NeedReturnFields.AddRange(act.NeedUpDateFields);
bill.IsDeleteEntry = false;
InvoiceOrderSavrMode orderSaveModel = new InvoiceOrderSavrMode();
orderSaveModel.F_VHUB_Text = act.F_VHUB_Text;
orderSaveModel.F_URXD_Date = act.F_URXD_Date;
orderSaveModel.FID = act.Fid;
bill.Model = orderSaveModel;
LogHelper.Info(bill.Model);
var result = _kingDeeService.Save(FormId, bill);
LogHelper.Info(result);
//bill
}
#endregion
}
}

View File

@@ -595,19 +595,18 @@ namespace MyCode.Project.Services.Implementation
{
throw new BaseException("不能跨采购组织创建发货通知单");
}
if (loginInfo.IfForeign == 1 && string.IsNullOrWhiteSpace(act.F_VHUB_Text))
{
throw new BaseException("国外的供应商发票号和发票日期是必填.");
}
if (loginInfo.IfForeign == 1)
{
if (_invoiceOrderRepository.IsExist(t => t.F_VHUB_Text == act.F_VHUB_Text && t.SupplierId == loginInfo.SupplierId))
if (loginInfo.IfForeign == 1 && string.IsNullOrWhiteSpace(act.F_VHUB_Text))
{
throw new BaseException("发票号重复");
throw new BaseException("国外的供应商发票号和发票日期是必填.");
}
if (loginInfo.IfForeign == 1)
{
if (_invoiceOrderRepository.IsExist(t => t.F_VHUB_Text == act.F_VHUB_Text && t.SupplierId == loginInfo.SupplierId))
{
throw new BaseException("发票号重复");
}
}
}
//string ReceiveorgCode = SystemConfig.ReceiveorgCode;
//List<string> ReceiveorgCodeList = ReceiveorgCode.Split(',').ToList();
@@ -773,7 +772,5 @@ namespace MyCode.Project.Services.Implementation
}
#endregion
}
}