合并代码

This commit is contained in:
2025-07-26 17:31:00 +08:00
parent 6a70edbc21
commit 484f19cd52
97 changed files with 868 additions and 55 deletions

View File

@@ -0,0 +1,60 @@
using GZ_LTHPilot_ORDER.Service;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GZ_LTHPilot_ORDER.T_IV_SALESIC.ServicePlugIn
{
[Description("服务插件:发票审核,刷新销售订单累计开票金额字段"), HotUpdate]
public class Audit : AbstractOperationServicePlugIn
{
public override void OnPreparePropertys(PreparePropertysEventArgs e)
{
base.OnPreparePropertys(e);
e.FieldKeys.Add("F_PaperNumber");
}
/// <summary>
/// 审核插件执行后插件、事务提交后事件
/// </summary>
/// <param name="e"></param>
public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
{
base.AfterExecuteOperationTransaction(e);
foreach (var bill in e.DataEntitys)
{
var org = bill["SALEORGID"] as DynamicObject;
var orgId = org["Id"].ToString(); // 销售订单
var contractNo = bill["F_PaperNumber"].ToString(); // 纸质合同号
// 销售订单服务
var saleOrderService = new SaleOrderService(this.Context);
// TODO 根据组织和纸质合同号查找销售订单
var saleOrderList = saleOrderService.GetSaleOrderByOrgIdAndContractNo(orgId, contractNo);
if (saleOrderList.Count == 0)
{
//var errInfo = string.Format("纸质合同号:{0},没有找到对应的销售订单,请检查销售订单是否已审核,或者被作废", contractNo);
//throw new Exception(errInfo);
continue;
}
if (saleOrderList.Count > 1)
{
var errInfo = string.Format("纸质合同号:{0},找到多个销售订单,请检查组织内纸质合同号唯一性", contractNo);
throw new Exception(errInfo);
}
var saleOrder = saleOrderList[0];
// 发票服务
SaleSicsService saleSicsService = new SaleSicsService(this.Context);
// TODO 刷新销售订单单头的累计开票金额
saleSicsService.UpdateSaleOrderSumSicsamountBySaleOrder(saleOrder);
}
}
}
}

View File

@@ -0,0 +1,76 @@
using GZ_LTHPilot_ORDER.Service;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GZ_LTHPilot_ORDER.T_IV_SALESIC.ServicePlugIn
{
[Description("服务插件:发票提交,校验销售订单累计开票金额加开票金额不能大于销售订单价税合计本币"), HotUpdate]
public class Submit : AbstractOperationServicePlugIn
{
public override void OnPreparePropertys(PreparePropertysEventArgs e)
{
base.OnPreparePropertys(e);
e.FieldKeys.Add("F_PaperNumber");
e.FieldKeys.Add("FAFTERTOTALTAX");
}
public override void BeforeExecuteOperationTransaction(BeforeExecuteOperationTransaction e)
{
base.BeforeExecuteOperationTransaction(e);
//throw new Exception("asdfas");
foreach (var bill in e.SelectedRows)
{
var org = bill["SALEORGID"] as DynamicObject;
var orgId = org["Id"].ToString(); // 销售订单
var contractNo = bill["F_PaperNumber"].ToString(); // 纸质合同号
var FAFTERTOTALTAX = Convert.ToDecimal(bill["FAFTERTOTALTAX"]); // 发票单头价税合计本币
// 销售订单服务
var saleOrderService = new SaleOrderService(this.Context);
// TODO 根据组织和纸质合同号查找销售订单
var saleOrderList = saleOrderService.GetSaleOrderByOrgIdAndContractNo(orgId, contractNo);
if (saleOrderList.Count == 0)
{
//var errInfo = string.Format("纸质合同号:{0},没有找到对应的销售订单,请检查销售订单是否已审核,或者被作废", contractNo);
//throw new Exception(errInfo);
continue;
}
if (saleOrderList.Count > 1)
{
var errInfo = string.Format("纸质合同号:{0},找到多个销售订单,请检查组织内纸质合同号唯一性", contractNo);
throw new Exception(errInfo);
}
var saleOrder = saleOrderList[0];
// 销售订单价税合计
var saleOrderAmount = Convert.ToDecimal(saleOrder["FBILLALLAMOUNT_LC"]);
// 销售订单累计开票金额
var saleOrderINVOICEAMOUNT = Convert.ToDecimal(saleOrder["F_INVOICEAMOUNT"]);
// 校验销售订单累计开票金额+本次开票金额不能大于销售订单价税合计
if (saleOrderAmount < saleOrderINVOICEAMOUNT + FAFTERTOTALTAX)
{
//有错误信息
e.Cancel = true;
IOperationResult operationResult = new OperationResult();
operationResult.OperateResult.Add(new OperateResult()
{
PKValue = "1",
Name = "检查开票金额是否超额",
MessageType = MessageType.FatalError,
Message = string.Format($"纸质合同号:'{contractNo}' ,销售订单价税合计本币:{saleOrderAmount} ,累计开票金额:{saleOrderINVOICEAMOUNT},本次开票金额:{FAFTERTOTALTAX},已超额,不允许提交"),
SuccessStatus = false
});
this.OperationResult.MergeResult(operationResult);
}
}
}
}
}

View File

@@ -0,0 +1,59 @@
using GZ_LTHPilot_ORDER.Service;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GZ_LTHPilot_ORDER.T_IV_SALESIC.ServicePlugIn
{
[Description("服务插件:发票反审核,刷新销售订单累计开票金额字段"), HotUpdate]
public class UnAudit : AbstractOperationServicePlugIn
{
public override void OnPreparePropertys(PreparePropertysEventArgs e)
{
base.OnPreparePropertys(e);
e.FieldKeys.Add("F_PaperNumber");
}
/// <summary>
/// 审核插件执行后插件、事务提交后事件
/// </summary>
/// <param name="e"></param>
public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
{
base.AfterExecuteOperationTransaction(e);
foreach (var bill in e.DataEntitys)
{
var org = bill["SALEORGID"] as DynamicObject;
var orgId = org["Id"].ToString(); // 销售订单
var contractNo = bill["F_PaperNumber"].ToString(); // 纸质合同号
// 销售订单服务
var saleOrderService = new SaleOrderService(this.Context);
// TODO 根据组织和纸质合同号查找销售订单
var saleOrderList = saleOrderService.GetSaleOrderByOrgIdAndContractNo(orgId, contractNo);
if (saleOrderList.Count == 0)
{
//var errInfo = string.Format("纸质合同号:{0},没有找到对应的销售订单,请检查销售订单是否已审核,或者被作废", contractNo);
//throw new Exception(errInfo);
continue;
}
if (saleOrderList.Count > 1)
{
var errInfo = string.Format("纸质合同号:{0},找到多个销售订单,请检查组织内纸质合同号唯一性", contractNo);
throw new Exception(errInfo);
}
var saleOrder = saleOrderList[0];
// 发票服务
SaleSicsService saleSicsService = new SaleSicsService(this.Context);
// TODO 刷新销售订单单头的累计开票金额
saleSicsService.UpdateSaleOrderSumSicsamountBySaleOrder(saleOrder);
}
}
}
}