王 垚
2021-02-28 1998f3a802df15de34030ea7deac62ed0b494e53
报表
2个文件已添加
218 ■■■■■ 已修改文件
src/BLL/Demo.Report/PRD/prd_CompleteSetRateReport.cs 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.Report/PRD/prd_TimelinessRateReport.cs 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.Report/PRD/prd_CompleteSetRateReport.cs
New file
@@ -0,0 +1,108 @@
using Kingdee.BOS;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.Contracts.Report;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.Orm.DataEntity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using Newtonsoft.Json;
using ZD.Cloud.Logger;
namespace Demo.Report
{
    /// <summary>
    /// 齐套率报表
    /// </summary>
    [Description("齐套率报表")]
    [HotUpdate]
    public class prd_ExtractionPlanDetail : SysReportBaseService
    {
        public override void Initialize()
        {
            //base.Initialize();
            //this.ReportProperty.ReportType = ReportType.REPORTTYPE_NORMAL;
            //this.ReportProperty.ReportName = new LocaleValue("供应商送料计划列表订单", base.Context.UserLocale.LCID);
            //this.ReportProperty.IsUIDesignerColumns = true;
            //this.ReportProperty.IsGroupSummary = true;
            //this.ReportProperty.SimpleAllCols = false;
            base.Initialize();
            // 简单账表类型:普通、树形、分页
            this.ReportProperty.ReportType = ReportType.REPORTTYPE_NORMAL;
            this.IsCreateTempTableByPlugin = true;
            //取代码中配置的列
            this.ReportProperty.IsUIDesignerColumns = false;
            //是否分组汇总
            this.ReportProperty.IsGroupSummary = true;
        }
        public override ReportHeader GetReportHeaders(IRptParams filter)
        {
            ReportHeader header = new ReportHeader();
            header.AddChild("FROWID", new LocaleValue("序号"), SqlStorageType.Sqlvarchar).ColIndex = 0;
            header.AddChild("FHDATE", new LocaleValue("提料计划日期"), SqlStorageType.Sqlvarchar).ColIndex = 1;
            header.AddChild("FHSOURCEBILLNO", new LocaleValue("生产订单编号"), SqlStorageType.Sqlvarchar).ColIndex = 2;
            //header.AddChild("Fcolumn3", new LocaleValue("生产线"), SqlStorageType.Sqlvarchar).ColIndex = 3;
            header.AddChild("FSUPPLIERNUMBER", new LocaleValue("供应商编码"), SqlStorageType.Sqlvarchar).ColIndex = 4;
            header.AddChild("FSUPPLIERNAME", new LocaleValue("供应商名称"), SqlStorageType.Sqlvarchar).ColIndex = 5;
            //header.AddChild("Fcolumn6", new LocaleValue("产品编码"), SqlStorageType.Sqlvarchar).ColIndex = 6;
            //header.AddChild("Fcolumn7", new LocaleValue("产品名称"), SqlStorageType.Sqlvarchar).ColIndex = 7;
            //header.AddChild("Fcolumn8", new LocaleValue("产品规格"), SqlStorageType.Sqlvarchar).ColIndex = 8;
            header.AddChild("FMATERIALNUMBER", new LocaleValue("原材料编码"), SqlStorageType.Sqlvarchar).ColIndex = 9;
            header.AddChild("FMATERIALNAME", new LocaleValue("原材料名称"), SqlStorageType.Sqlvarchar).ColIndex = 10;
            header.AddChild("FSPECIFICATION", new LocaleValue("原材料规格"), SqlStorageType.Sqlvarchar).ColIndex = 11;
            header.AddChild("FHQTY", new LocaleValue("订单数量")).ColIndex = 11;
            header.AddChild("FREALQTY", new LocaleValue("实际到货数量")).ColIndex = 11;
            header.AddChild("FRKDATE", new LocaleValue("实际到货时间"), SqlStorageType.Sqlvarchar).ColIndex = 12;
            return header;
        }
        public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
        {
            base.BuilderReportSqlAndTempTable(filter, tableName);
            DynamicObject customFil = filter.FilterParameter.CustomFilter;
            string FDATE = ""; //提料日期
            string FProductLine = ""; //生产线
            string FMoBillNo = ""; //生产订单号
            string FMaterialID = ""; //物料
            string FSupplyID = ""; //供应商
            FDATE = customFil["FDATE"].ToString();
            FMoBillNo = customFil["FMoBillNo"].ToString();
            if (((DynamicObject)customFil["FMaterialID"]) != null)
            {
                FMaterialID = ((DynamicObject)customFil["FMaterialID"])["Id"].ToString();
            }
            if (((DynamicObject)customFil["FProductLine"]) != null)
            {
                FProductLine = ((DynamicObject)customFil["FProductLine"])["Id"].ToString();
            }
            if (((DynamicObject)customFil["FSupplyID"]) != null)
            {
                FSupplyID = ((DynamicObject)customFil["FSupplyID"])["Id"].ToString();
            }
            string sql = string.Format($"/*dialect*/ EXEC pr_TimelinessRateReport '{tableName}','{FDATE}','{FMoBillNo}','{FProductLine}','{FSupplyID}','{FMaterialID}'");
            LogHelper.Info(sql);
            DBUtils.Execute(this.Context, sql);
        }
        public override void CloseReport()
        {
        }
    }
}
src/BLL/Demo.Report/PRD/prd_TimelinessRateReport.cs
New file
@@ -0,0 +1,110 @@
using Kingdee.BOS;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.Contracts.Report;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.Orm.DataEntity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using Newtonsoft.Json;
using ZD.Cloud.Logger;
namespace Demo.Report
{
    /// <summary>
    /// 齐套率报表
    /// </summary>
    [Description("齐套率报表")]
    [HotUpdate]
    public class prd_TimelinessRateReport : SysReportBaseService
    {
        public override void Initialize()
        {
            //base.Initialize();
            //this.ReportProperty.ReportType = ReportType.REPORTTYPE_NORMAL;
            //this.ReportProperty.ReportName = new LocaleValue("供应商送料计划列表订单", base.Context.UserLocale.LCID);
            //this.ReportProperty.IsUIDesignerColumns = true;
            //this.ReportProperty.IsGroupSummary = true;
            //this.ReportProperty.SimpleAllCols = false;
            base.Initialize();
            // 简单账表类型:普通、树形、分页
            this.ReportProperty.ReportType = ReportType.REPORTTYPE_NORMAL;
            this.IsCreateTempTableByPlugin = true;
            //取代码中配置的列
            this.ReportProperty.IsUIDesignerColumns = false;
            //是否分组汇总
            this.ReportProperty.IsGroupSummary = true;
            this.ReportProperty.PrimaryKeyFieldName = "FIDENTITYID";
        }
        public override ReportHeader GetReportHeaders(IRptParams filter)
        {
            ReportHeader header = new ReportHeader();
            header.AddChild("FIDENTITYID", new LocaleValue("序号"), SqlStorageType.SqlInt).ColIndex = 1;
            header.AddChild("FHDATE", new LocaleValue("提料计划日期", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar).ColIndex = 1;
            header.AddChild("FHSOURCEBILLNO", new LocaleValue("生产订单编号", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar).ColIndex = 2;
            header.AddChild("FSOURCENAME", new LocaleValue("生产线"), SqlStorageType.Sqlvarchar).ColIndex = 3;
            header.AddChild("FSUPPLIERNUMBER", new LocaleValue("供应商编码", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar).ColIndex = 4;
            header.AddChild("FSUPPLIERNAME", new LocaleValue("供应商名称", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar).ColIndex = 5;
            header.AddChild("FMATERIALNUMBER2", new LocaleValue("产品编码"), SqlStorageType.Sqlvarchar).ColIndex = 6;
            header.AddChild("FMATERIALNAME2", new LocaleValue("产品名称"), SqlStorageType.Sqlvarchar).ColIndex = 7;
            header.AddChild("FSPECIFICATION2", new LocaleValue("产品规格"), SqlStorageType.Sqlvarchar).ColIndex = 8;
            header.AddChild("FMATERIALNUMBER", new LocaleValue("原材料编码", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar).ColIndex = 9;
            header.AddChild("FMATERIALNAME", new LocaleValue("原材料名称", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar).ColIndex = 10;
            header.AddChild("FSPECIFICATION", new LocaleValue("原材料规格", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar).ColIndex = 11;
            header.AddChild("FHQTY", new LocaleValue("订单数量", this.Context.UserLocale.LCID),SqlStorageType.SqlDecimal).ColIndex = 11;
            header.AddChild("FREALQTY", new LocaleValue("实际到货数量", this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal).ColIndex = 11;
            header.AddChild("FRKDATE", new LocaleValue("实际到货时间", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar).ColIndex = 12;
            header.AddChild("FTYPE", new LocaleValue("类型", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar).ColIndex = 12;
            header.AddChild("FJSRATE", new LocaleValue("到货及时率", this.Context.UserLocale.LCID), SqlStorageType.SqlDecimal).ColIndex = 12;
            return header;
        }
        public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
        {
            base.BuilderReportSqlAndTempTable(filter, tableName);
            DynamicObject customFil = filter.FilterParameter.CustomFilter;
            string FDATE = ""; //提料日期
            string FProductLine = ""; //生产线
            string FMoBillNo = ""; //生产订单号
            string FMaterialID = ""; //物料
            string FSupplyID = ""; //供应商
            FDATE = customFil["FDATE"].ToString();
            FMoBillNo = customFil["FMoBillNo"]?.ToString();
            if (((DynamicObject)customFil["FMaterialID"]) != null)
            {
                FMaterialID = ((DynamicObject)customFil["FMaterialID"])["Id"].ToString();
            }
            if (((DynamicObject)customFil["FProductLine"]) != null)
            {
                FProductLine = ((DynamicObject)customFil["FProductLine"])["Id"].ToString();
            }
            if (((DynamicObject)customFil["FSupplyID"]) != null)
            {
                FSupplyID = ((DynamicObject)customFil["FSupplyID"])["Id"].ToString();
            }
            string sql = string.Format($"/*dialect*/ EXEC pr_TimelinessRateReport '{tableName}','{FDATE}','{FMoBillNo}','{FProductLine}','{FSupplyID}','{FMaterialID}'");
            LogHelper.Info(sql);
            DBUtils.Execute(this.Context, sql);
        }
        public override void CloseReport()
        {
        }
    }
}