第三方系统给金蝶云星空发普通信息首页弹框二开示例

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-23浏览:1

第三方系统给金蝶云星空发普通信息首页弹框二开示例

二开普通信息首页弹框效果如下:


步骤一:,首先要把普通消息弹框的选项勾选上:


步骤二:自定义WebAPI接口:

using Kingdee.BOS.App.Core;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Workflow.App.Core.Repositories;
using Kingdee.BOS.Workflow.Models.WindowRemind;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kingdee.BOS.Printing.PlugIn.Test
{
    public class MsgBroadCastAPIService : Kingdee.BOS.WebApi.ServicesStub.AbstractWebApiBusinessService
    {

        public MsgBroadCastAPIService(Kingdee.BOS.ServiceFacade.KDServiceFx.KDServiceContext context)
            : base(context)
        { }
        public bool ExecuteService(string[] receivers,string title)
        {
            List<DynamicObject> recList = new List<DynamicObject>();
            List<long> msgReceivers = new List<long>();
            List<long> id = DBServiceHelper.GetSequenceInt64(this.KDContext.Session.AppContext, "T_BAS_BROADCASTMSG", 1).ToList();
            BroadCastMsg msg = new BroadCastMsg(new DynamicObject(Kingdee.BOS.Workflow.Models.WindowRemind.BroadCastMsg.BroadCastMsgType));
            msg.Title = new LocaleValue(Kingdee.BOS.Resource.ResManager.LoadKDString("您有新的普通消息", "002406000006760", Kingdee.BOS.Resource.SubSystemType.BOS));
            msg.Content = new LocaleValue(title);
            DateTime failureTime = TimeServiceHelper.GetSystemDateTime(this.KDContext.Session.AppContext).AddMinutes(6);
            msg.FailureTime = failureTime;
            msg.SendType = 4;
            msg.Id = id[0];

            foreach (var item in receivers)
            {
                int msgReceiver = int.Parse(item);
                MessageRepository ser = new MessageRepository();
                bool isCommonMsgWindowRemind = ser.GetIsCommonMsgWindowRemind(this.KDContext.Session.AppContext, msgReceiver);
                if (isCommonMsgWindowRemind)
                {
                    BroadCastReceiver rec = new BroadCastReceiver();
                    rec.Receiver = msgReceiver;
                    rec.Id = id[0];
                    recList.Add(rec);
                }
            }
            if (recList.Count > 0)
            {
                SaveService service = new SaveService();
                service.Save(this.KDContext.Session.AppContext, new DynamicObject[] { msg });
                service.Save(this.KDContext.Session.AppContext, recList.ToArray());
            }

            return true;
        }
    }
}

第三步:客户端调用示例:

private void btnTest_Click(object sender, EventArgs e)
        {
            if (Login())
            {
                string json = "{\"Model\":[{\"FTitle\":\"我是标题\",\"FContent\":\"我是内容,单据id=1\",\"FReceivers\":\"demo\",\"FType\":\"1\",\"FObjectTypeId\":\"AM_VOUCHER\",\"FKeyValue\":\"100012\"}]}";
                object[] paramInfo = new object[] { json};
                var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.SendMsg", paramInfo);
                if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].Value<bool>())
                {
                    object[] paramInfo2 = new object[]  { new string[]{"100008"}, "我是接口测试"
                };
                client.Execute<string>("Kingdee.BOS.Printing.PlugIn.Test.MsgBroadCastAPIService.ExecuteService,Kingdee.BOS.Printing.PlugIn.Test", paramInfo2);
                }
            }
        }


第三方系统给金蝶云星空发普通信息首页弹框二开示例

二开普通信息首页弹框效果如下:步骤一:,首先要把普通消息弹框的选项勾选上:步骤二:自定义WebAPI接口:using Kingdee.BOS.App.Core;usi...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息