Ejemplo n.º 1
0
        /// <summary>
        /// 利用K/3 Cloud标准的交互消息界面,显示消息:通常用于给用户选择是、否
        /// </summary>
        /// <remarks>
        /// 本案例,向用户提示负库存,如果用户选择是,则继续操作;否则中断操作
        /// </remarks>
        private void ShowK3DisplayMessage()
        {
            // 定义交互消息标识,以与其他交互消息区分开
            string spensorKey = "VTR_ReportAudit.ServicePlugIn.Operation.S160425ShowInteractionOpPlug.ShowK3DisplayMessage";

            // 判断用户是否已经确认过本交互信息
            if (this.Option.HasInteractionFlag(spensorKey))
            {
                // this.Option.HasInteractionFlag()在如下两种情况下,返回true:
                // 1. 用户已经确认过本交互信息,并选择了继续
                // 2. 外围代码,在调用本操作前,通过如下代码,强制要求不显示交互消息:
                // this.Option.SetIgnoreInteractionFlag(true);
                // 因此,如果 this.Option.HasInteractionFlag() == true, 表示需要忽略本交互
                return;
            }
            // 提示信息的列标题,以“~|~”分开两列
            string titleMsg = "本节点为最后节点,是否继续完成审批?";
            // 对应的提示信息格式,以"~|~"分开两列,以{n}进行占位
            string errMsg = "最后节点,是否继续完成审批?";
            // 构建消息模型K3DisplayerModel,在此对象中,添加消息内容
            K3DisplayerModel model = K3DisplayerModel.Create(Context, titleMsg);
            // 消息内容:可以添加多行
            string rowMsg = string.Format(errMsg, "本节点为最后节点,是否继续完成审批?");

            ((K3DisplayerModel)model).AddMessage(rowMsg);
            // 消息抬头

            model.Option.SetVariableValue(K3DisplayerModel.CST_FormTitle, "本节点为最后节点,是否继续完成审批?");
            // 是否继续按钮
            model.FieldAppearances[1].Width = new LocaleValue("300");


            model.OKButton.Visible     = true;
            model.OKButton.Caption     = new LocaleValue("继续", Context.UserLocale.LCID);
            model.CancelButton.Visible = true;
            model.CancelButton.Caption = new LocaleValue("取消", Context.UserLocale.LCID);
            // 创建一个交互提示错误对象KDInteractionException:
            // 通过throw new KDInteractionException()的方式,向操作调用者,输出交互信息
            KDInteractionException ie = new KDInteractionException(this.Option, spensorKey);

            // 提示信息显示界面
            ie.InteractionContext.InteractionFormId = Kingdee.BOS.Core.FormIdConst.BOS_K3Displayer;
            // 提示内容
            ie.InteractionContext.K3DisplayerModel = model;
            // 是否需要交互
            ie.InteractionContext.IsInteractive = true;
            // 抛出错误,终止流程
            throw ie;
        }
Ejemplo n.º 2
0
        public override void BeforeSave(BOS.Core.Bill.PlugIn.Args.BeforeSaveEventArgs e)
        {
            base.BeforeSave(e);
            //销售订单的“当前组织”、“己审核”的销售订单的当前物料的数量   和 该单据物料之和大于最大销量 不允许提交当前销售订单
            EntryEntity             entryEntity = this.View.BusinessInfo.GetEntryEntity("FSaleOrderEntry");
            DynamicObjectCollection rows        = this.View.Model.GetEntityDataObject(entryEntity);
            IOperationResult        operaRst    = new OperationResult();

            operaRst.IsSuccess          = false;
            operaRst.CustomMessageModel = K3DisplayerModel.Create(this.Context, "行号~|~校验信息");
            operaRst.CustomMessageModel.FieldAppearances[0].Width = new LocaleValue("100", this.Context.UserLocale.LCID);
            operaRst.CustomMessageModel.FieldAppearances[1].Width = new LocaleValue("100", this.Context.UserLocale.LCID);
            operaRst.CustomMessageModel.FieldAppearances[2].Width = new LocaleValue("300", this.Context.UserLocale.LCID);

            foreach (var row in rows)
            {
                DynamicObject material = row["MaterialID"] as DynamicObject;
                decimal       qty      = Convert.ToDecimal(row["Qty"]);
                decimal       maxQty   = Convert.ToDecimal(material["F_PAEZ_maxSaleQty"]);
                int           seq      = Convert.ToInt32(row["Seq"]);
                if (null == material)
                {
                    return;
                }

                string sql = string.Format(@"SELECT sum(b.FQTY) qty FROM T_SAL_ORDER a inner join T_SAL_ORDERENTRY b  on a.fid =b.fid  WHERE b.FMATERIALID ='{0}' AND a.FDOCUMENTSTATUS  in ('B','C') ", material["Id"]);
                DynamicObjectCollection saleOrderCol = DBUtils.ExecuteDynamicObject(this.Context, sql);
                if (saleOrderCol.Count > 0)
                {
                    qty = qty + Convert.ToDecimal(saleOrderCol[0]["qty"]);
                }

                if (qty > maxQty)
                {
                    operaRst.CustomMessageModel.AddMessage(string.Format("{0}~|~{1}", seq, "大于此物料的最大销量,不允许提交当前销售订单"));
                }
            }

            if (operaRst.CustomMessageModel.Messages.Count() > 0)
            {
                e.Cancel = true;

                this.View.ShowK3Displayer(operaRst.CustomMessageModel);
            }
        }
Ejemplo n.º 3
0
        public virtual void ShowK3DisplayerMsg(List <string> msgs)
        {
            if (msgs != null && msgs.Count > 0)
            {
                string           spensorKey = "JDSample.ServicePlugIn.Operation.S160425ShowInteractionOpPlug.ShowK3DisplayMessage";
                K3DisplayerModel model      = K3DisplayerModel.Create(Context, "操作结果提示信息");

                foreach (var msg in msgs)
                {
                    // 消息内容:可以添加多行
                    if (!string.IsNullOrWhiteSpace(msg))
                    {
                        model.AddMessage(msg);
                    }
                }

                // 消息抬头
                model.Option.SetVariableValue(K3DisplayerModel.CST_FormTitle, "有多条信息需要您确认,是否继续?");
                // 是否继续按钮
                model.OKButton.Visible     = true;
                model.OKButton.Caption     = new LocaleValue("是", Context.UserLocale.LCID);
                model.CancelButton.Visible = true;
                model.CancelButton.Caption = new LocaleValue("否", Context.UserLocale.LCID);
                // 创建一个交互提示错误对象KDInteractionException:
                // 通过throw new KDInteractionException()的方式,向操作调用者,输出交互信息
                KDInteractionException ie = new KDInteractionException(this.Option, spensorKey);
                // 提示信息显示界面
                ie.InteractionContext.InteractionFormId = FormIdConst.BOS_K3Displayer;
                // 提示内容
                ie.InteractionContext.K3DisplayerModel = model;
                // 是否需要交互
                ie.InteractionContext.IsInteractive = true;
                // 抛出错误,终止流程

                throw ie;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 操作执行前逻辑
        /// </summary>
        /// <param name="e"></param>
        public override void BeginOperationTransaction(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.BeginOperationTransactionArgs e)
        {
            JNBandPara actband    = new JNBandPara();
            JNBandPara toband     = new JNBandPara();
            double     payamount  = 0;
            var        billGroups = e.DataEntitys;
            string     database   = this.Context.DataCenterName;
            string     token      = "";
            int        i          = 0;

            foreach (var billGroup in billGroups)
            {
                DynamicObject BillType     = billGroup["BillTypeID"] as DynamicObject;
                string        BillTypeName = Convert.ToString(BillType["name"]);
                if (BillTypeName != "其他业务付款单")
                {
                    DynamicObjectCollection BILLENTRYDATAs = billGroup["PAYBILLENTRY"] as DynamicObjectCollection;
                    foreach (var BILLENTRYDATA in BILLENTRYDATAs)
                    {
                        DynamicObject FrACCOUNT    = BILLENTRYDATA["FACCOUNTID"] as DynamicObject;
                        int           SETTLETYPEID = Convert.ToInt16(BILLENTRYDATA["SETTLETYPEID_Id"]);
                        if (FrACCOUNT != null)
                        {
                            DynamicObject FrBAND = FrACCOUNT["BANKID"] as DynamicObject;
                            if (FrBAND != null && SETTLETYPEID == 4)
                            {
                                actband.bandid = Convert.ToInt32(BILLENTRYDATA["FACCOUNTID_Id"]);
                                //actband.addr = Convert.ToString(FrACCOUNT["BANKADDRESS"]);
                                actband.name     = Convert.ToString(FrACCOUNT["Name"]);
                                actband.bandnum  = Convert.ToString(FrACCOUNT["ACNTBRANCHNUMBER"]);
                                actband.cn       = Convert.ToString(FrACCOUNT["NUMBER"]);
                                actband.bandname = Convert.ToString(FrBAND["Name"]);


                                toband.addr     = Convert.ToString(BILLENTRYDATA["OpenAddressRec"]);
                                toband.cn       = Convert.ToString(BILLENTRYDATA["OPPOSITEBANKACCOUNT"]);
                                toband.bandname = Convert.ToString(BILLENTRYDATA["OPPOSITEBANKNAME"]);
                                toband.name     = Convert.ToString(BILLENTRYDATA["OPPOSITECCOUNTNAME"]);
                                payamount       = Convert.ToDouble(BILLENTRYDATA["REALPAYAMOUNTFOR"]);
                                Int32 EntryID = Convert.ToInt32(BILLENTRYDATA["Id"]);
                                if (i == 0)//首单获取令牌
                                {
                                    token = checkin(this.Context, actband);
                                    i++;
                                }
                                //判断对公对私业务
                                int    RecType = Convert.ToInt16(BILLENTRYDATA["RecType"]);
                                string result  = "";
                                if (RecType == 0)//对公
                                {
                                    result = BtoBPay(this.Context, actband, toband, payamount, "", token);
                                }
                                else//对私
                                {
                                    int F_VTR_Bocflag = Convert.ToInt32(BILLENTRYDATA["F_VTR_Bocflag"]);
                                    result = BtoCPay(this.Context, actband, toband, payamount, "", F_VTR_Bocflag, token);
                                }
                                if (result.Length > 0)
                                {
                                    BusinessDataServiceHelper.SetState(this.Context, "T_AP_PAYBILLENTRY_B", "FSUBMITSTATUS", "B", "FEntryID", new object[] { EntryID });
                                    //BusinessDataServiceHelper.s
                                    string sql = string.Format("update T_AP_PAYBILLENTRY_B set F_JNobssid={0} where FEntryID={1}", result, EntryID.ToString());
                                    DBUtils.Execute(this.Context, sql);
                                }
                                else
                                {
                                    // 定义交互消息标识,以与其他交互消息区分开
                                    string spensorKey = "JNbandAudit.ServicePlugIn.Operation.S160425ShowInteractionOpPlug.ShowK3DisplayMessage";
                                    // 提示信息的列标题,以“~|~”分开两列
                                    string titleMsg = "提交银行失败";
                                    // 对应的提示信息格式,以"~|~"分开两列,以{n}进行占位
                                    string           errMsg = "提交银行失败";
                                    K3DisplayerModel model  = K3DisplayerModel.Create(Context, titleMsg);
                                    // 消息内容:可以添加多行
                                    string rowMsg = string.Format(errMsg, "提交银行失败");
                                    ((K3DisplayerModel)model).AddMessage(rowMsg);
                                    model.Option.SetVariableValue(K3DisplayerModel.CST_FormTitle, "本节点为最后节点,是否继续完成审批?");
                                    // 是否继续按钮
                                    model.FieldAppearances[1].Width = new LocaleValue("300");


                                    model.OKButton.Visible     = true;
                                    model.OKButton.Caption     = new LocaleValue("继续", Context.UserLocale.LCID);
                                    model.CancelButton.Visible = true;
                                    model.CancelButton.Caption = new LocaleValue("取消", Context.UserLocale.LCID);
                                    // 创建一个交互提示错误对象KDInteractionException:
                                    // 通过throw new KDInteractionException()的方式,向操作调用者,输出交互信息
                                    KDInteractionException ie = new KDInteractionException(this.Option, spensorKey);
                                    // 提示信息显示界面
                                    ie.InteractionContext.InteractionFormId = Kingdee.BOS.Core.FormIdConst.BOS_K3Displayer;
                                    // 提示内容
                                    ie.InteractionContext.K3DisplayerModel = model;
                                    // 是否需要交互
                                    ie.InteractionContext.IsInteractive = true;
                                    // 抛出错误,终止流程
                                    throw ie;
                                }
                            }
                        }
                    }
                    //i++;
                }
            }

            if (token.Length > 1)
            {
                checkout(this.Context, actband);
            }
        }