采购订单中采购单价用颜色标注进行警示的应用原创
金蝶云社区-会飞的猪
会飞的猪
18人赞赏了该文章 752次浏览 未经作者许可,禁止转载编辑于2021年03月07日 12:50:28

业务场景:

      采购员一次可能要录入几十条物料的情况下,采购经理在审核单价的时候要一条条去审核单价工作量比较大,也很容易出错,客户希望系统能先做一轮的快速判断,抓取最近一次的采购单价进行对比,用颜色标注采购单价,醒目的进行单价异常的预警。

实现方案:

      在采购订单中设置一个采购参考价,取服务规则中的获取历史采购单价,然后做二开插件,进行比较参考价与单价,用颜色进行醒目的标注。如何设置获取历史采购单价,可以参考我的另一个文章出库申请单自定义金额字段获取采购单价

效果图:

image.png

二开插件代码:

 [Description("【单据背景色插件】")]
    [Kingdee.BOS.Util.HotUpdate]
    public class EntrySetBackcolor:AbstractBillPlugIn
    {
        public override void AfterBindData(EventArgs e)
        {
            base.AfterBindData(e);
            //判断单据是否为新增状态
            if(this.View.OpenParameter.Status.Equals(OperationStatus.ADDNEW))
            {
                //隐藏标签
                this.View.GetControl("F_PEQF_GropTitle").Visible = false;
                this.View.GetControl("F_PEQF_Lable").Visible = false;
                this.View.GetControl("F_PEQF_Lable1").Visible = false;

            }

        }
        private bool reset = true;
        public override void EntryBarItemClick(BarItemClickEventArgs e)
        {
            base.EntryBarItemClick(e);
            reset = !reset;
            var rowcount = this.View.Model.GetEntryRowCount("FPOOrderEntry");
            if(rowcount<=0)
            {
                return;
            }
            var backcolor0 = reset ? "" : "#FF4500";
            var backcolor1 = reset ? "" : "	#3CB371";
            var grid = this.View.GetControl<EntryGrid>("FPOOrderEntry");
            if(e.BarItemKey== "PEQF_tbButton")
            {
                for(var x=0;x<rowcount;++x)
                {
                    //var backcolor = x % 2 == 0 ? backcolor0 : backcolor1;
                    ////grid.SetBackcolor("F_PEQF_Colour", backcolor, x); n
                    //grid.SetBackcolor("FTaxPrice", backcolor, x);
                    int price = Convert.ToInt32(this.View.Model.GetValue("FTaxPrice", x));
                    int price1= Convert.ToInt32(this.View.Model.GetValue("F_PEQF_Price", x));
                    if(price<price1)
                    {
                        grid.SetBackcolor("FTaxPrice", backcolor1, x);
                    }
                    else
                    {
                        grid.SetBackcolor("FTaxPrice", backcolor0, x);
                    }
                }
            }
        }
    }


赞 18