create PROCEDURE Cux_Ar_ServiceLedger_Voucher_Proc@OrgId Int ,@result Int output
AS
BEGIN SET NOCOUNT ONDECLARE @Date DATETIME IF @OrgId = 0 or @OrgId=''BEGIN RAISERROR(N'获取当前组织ID失败!', 16, 1) RETURNEND SET @Date = GETDATE()BEGIN TRANSACTION BEGIN Try update lsar set lsar.fVOUCHERNO=gv.FVOUCHERGROUPNO ,lsar.FVOUCHERPERIOD=(gv.FYEAR*100+gv.FPERIOD ) from T_BAS_VOUCHER svh inner join T_AR_RECEIVABLE ar on ar.FID = svh.FSourceBillID and svh.FSourceBillKey = 'AR_receivable' inner join T_GL_VOUCHER gv on gv.FVOUCHERID = svh.FGLVoucherID inner join t_Ar_ReceivableEntry arl on ar.FID=arl.FID inner join t_Ar_ReceivableEntry_LK arlk on arlk.FENTRYID=arl.FENTRYID and arlk.FSTableName='LIX_t_ServiceLegderAr' inner joinLIX_t_ServiceLegderAr lsar on lsar.FDetailID= arlk.FSId where lsar.fVOUCHERNO=0 and ar.FSETTLEORGID=@OrgId; set @result=@@ROWCOUNT COMMIT TRANSACTIONEND TryBEGIN Catch ROLLBACK TRANSACTION DECLARE @ErrorMessage NVARCHAR(2000) DECLARE @ErrorSeverity INT DECLARE @ErrorState INT SELECT @ErrorMessage = ERROR_MESSAGE(), @ErrorSeverity = ERROR_SEVERITY(), @ErrorState = ERROR_STATE() RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState) END Catch END
using cux.kd.k3coloud.ar.serviceLedger;
using Kingdee.BOS.App.Data;
using Kingdee.BOS;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using Kingdee.BOS.Core.DynamicForm;namespace cux.kd.k3coloud.ar.serviceLedger
{[Description("获取凭证号插件")][HotUpdate]public class CuxArServiceLedgerListPlugin : AbstractListPlugIn{private static readonly Object Lockflag =new object();public override void AfterBarItemClick(AfterBarItemClickEventArgs e){base.AfterBarItemClick(e);if (e.BarItemKey.Equals("PBQO_Voucher_Button", StringComparison.OrdinalIgnoreCase)){this.View.ShowMessage("确定批量获取凭证号!", MessageBoxOptions.YesNo, action: (result) =>{if (result == MessageBoxResult.Yes){lock (Lockflag){this.View.GetBarItem("", "PBQO_Voucher_Button").Enabled = false;this.View.UpdateView("PBQO_Voucher_Button");List<SqlParam> paramList = new List<SqlParam>();paramList.Add(new SqlParam("@OrgId", KDDbType.Int32, this.Context.CurrentOrganizationInfo.ID));paramList.Add(new SqlParam("@result", KDDbType.Int64, '0') { Direction = ParameterDirection.Output });List<SqlParam> sp = DBUtils.ExecuteStoreProcedure(this.Context, "Cux_Ar_ServiceLedger_Voucher_Proc", paramList);String rs = sp[0].Value.ToString();this.View.ShowMessage(String.Format("更新记录数量为:{0}", rs), MessageBoxType.Notice);this.View.GetBarItem("", "PBQO_Voucher_Button").Enabled = true;this.View.UpdateView("PBQO_Voucher_Button");}}});}}}
}