Cloud保存时提示消息是否保存,点是保存,点否不保存。

业务场景:保存时,检查上游的销售出库单数量,和发货通知单数量是否一致,不一致时提示信息,点是则保存,点否不保存。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kingdee.BOS.Core;
using Kingdee.BOS.Core.DynamicForm.PlugIn.WizardForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.Metadata.EntityElement;
using Kingdee.BOS.Orm.DataEntity;
using System.Data;
using System.Collections;
using Kingdee.BOS.Core.DynamicForm;

namespace KDDHandle
{
    public class BoxAll : AbstractBillPlugIn
    {
        //是否弹出提示框标识
        private bool isShowMessage = true;

        public override void BeforeSave(Kingdee.BOS.Core.Bill.PlugIn.Args.BeforeSaveEventArgs e)
        {
            base.BeforeSave(e);
            this.View.Model.SetValue("F_ora_Integer", AllBoxNum());

            DataSet ds = Kingdee.BOS.ServiceHelper.DBServiceHelper.ExecuteDataSet
                        (this.Context, "exec A_eifire_KDDSaveCheck " + this.View.Model.GetValue("F_ora_Text1").ToString());

            if (ds.Tables[0].Rows[0][0].ToString() == "1")
            {
                string msg = ds.Tables[1].Rows[0][0].ToString();
                if (msg.Trim() != "" && isShowMessage)
                {
                    e.Cancel = true;
                    this.View.ShowMessage(msg.Replace("#####", Environment.NewLine), MessageBoxOptions.YesNo, new Action<MessageBoxResult>(result =>
                        {
                            if (result == MessageBoxResult.Yes)
                            {
                                isShowMessage = false;
                                this.View.InvokeFormOperation(FormOperationEnum.Save);//调用平台内置保存操作
                            }
                            else
                            {
                                //取消保存逻辑
                            }
                        }));
                }
            }
        }
    }
}

posted @ 2020-02-18 19:38  放放的Blog  阅读(309)  评论(0编辑  收藏  举报