保存前事件原创
8人赞赏了该文章
582次浏览
编辑于2022年07月25日 08:30:24
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Kingdee.BOS; using Kingdee.BOS.Core; //服务端 using Kingdee.BOS.Core.DynamicForm.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; //校验器 using Kingdee.BOS.Core.Validation; using System.ComponentModel; using System.Data; using Kingdee.BOS.App.Data; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Core.Metadata.FormElement; namespace BHR.K3.App.Service.PlugIn.BaoCunQian { [Description("单号—序号拼接保存")] [Kingdee.BOS.Util.HotUpdate] //继承操作服务插件 public class OnAddValidatorsHead : AbstractOperationServicePlugIn { //定义一个DataTable字段 DataTable dtTable; //OnPreparePropertys 数据加载前,确保需要的属性被加载 public override void OnPreparePropertys(PreparePropertysEventArgs e) { base.OnPreparePropertys(e); //加载本节使用的字段 e.FieldKeys.Add("FBILLNOFSEQ"); e.FieldKeys.Add("FBILLNOFseq"); } //本节使用的方法,事务开始前事件 public override void BeforeExecuteOperationTransaction(BeforeExecuteOperationTransaction e) { base.BeforeExecuteOperationTransaction(e); //e.CancelMessage = "测试终止操作执行"; //e.Cancel = true; //询价单明细 string InquirySup = "InquiryEntry"; string BillNo = "BillNo"; string Seq = "Seq"; string FBILLNOFSEQ = "FBILLNOFSEQ"; string FFormId = "FFormId"; string E9BillNo = ""; string E9Seq = ""; string E9FBILLNOFSEQ = ""; try { foreach (ExtendedDataEntity extended in e.SelectedRows) { int flog = 0; DynamicObject dy = extended.DataEntity; switch (dy[FFormId]) { //询价单 case "SVM_InquiryBill": InquirySup = "InquiryEntry"; BillNo = "BillNo"; Seq = "Seq"; break; //采购订单 case "PUR_PurchaseOrder": InquirySup = "POOrderEntry"; //单号-序号 FBILLNOFSEQ = "FBILLNOFSEQ"; E9BillNo = "FE9BILL"; E9Seq = "FE9XH"; E9FBILLNOFSEQ = "FE9BILLNOFSEQ"; break; default: break; } DynamicObjectCollection docPriceEntity = dy[InquirySup] as DynamicObjectCollection; foreach (DynamicObject HHentity in docPriceEntity) { //金蝶单号-序号 HHentity[FBILLNOFSEQ] = (Convert.ToString(dy[BillNo]) + "-" + Convert.ToString(HHentity[Seq])); HHentity[E9FBILLNOFSEQ] = (Convert.ToString(dy[E9BillNo]) + "-" + Convert.ToString(HHentity[E9Seq])); } } } catch (Exception) { throw; } } } }
推荐阅读