王 垚
2022-12-05 522db9238d27d94ef5b1f955463984b4c7c032b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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 ZD.Cloud.Logger;
 
namespace zymes_Project.Report
{
    /// <summary>
    /// 供应商送料计划列表
    /// </summary>
    [Description("供应商送料计划列表")]
    [HotUpdate]
    public class FeedPlanReport : SysReportBaseService
    {
 
        public override void Initialize()
        {
            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();
            // FIDENTITYID 序号  旧物料代码 物料代码    物料名称 规格型号    采购计量单位 供应商 库存数量 线边仓数量   采购在途数量 厂区  拖期数量 T数量 T + 1数量 T+2数量 T+3数量 T+4数量 T+5数量 T+6数量 T+7数量 合计
 
            header.AddChild("FIDENTITYID", new LocaleValue("序号"), SqlStorageType.Sqlvarchar).ColIndex=0;
            header.AddChild("Fcolumn2", new LocaleValue("旧物料代码"), SqlStorageType.Sqlvarchar).ColIndex = 1;
            header.AddChild("Fcolumn3", new LocaleValue("物料代码"), SqlStorageType.Sqlvarchar).ColIndex = 2;
            header.AddChild("Fcolumn4", new LocaleValue("物料名称"), SqlStorageType.Sqlvarchar).ColIndex = 3;
            header.AddChild("Fcolumn5", new LocaleValue("规格型号"), SqlStorageType.Sqlvarchar).ColIndex = 4;
            header.AddChild("Fcolumn43", new LocaleValue("货主"), SqlStorageType.Sqlvarchar).ColIndex = 5;
            header.AddChild("Fcolumn6", new LocaleValue("采购计量单位"), SqlStorageType.Sqlvarchar).ColIndex = 5;
            header.AddChild("Fcolumn7", new LocaleValue("供应商"), SqlStorageType.Sqlvarchar).ColIndex = 6;
            header.AddChild("Fcolumn8", new LocaleValue("库存数量"), SqlStorageType.Sqlvarchar).ColIndex = 7;
            header.AddChild("Fcolumn9", new LocaleValue("线边仓数量"), SqlStorageType.Sqlvarchar).ColIndex = 8;
            header.AddChild("Fcolumn10", new LocaleValue("采购在途数量"), SqlStorageType.Sqlvarchar).ColIndex = 9;
            header.AddChild("Fcolumn11", new LocaleValue("厂区"), SqlStorageType.Sqlvarchar).ColIndex = 10;
            header.AddChild("Fcolumn41", new LocaleValue("老厂仓库")).ColIndex = 10;
            header.AddChild("Fcolumn42", new LocaleValue("新厂仓库")).ColIndex = 10;
            header.AddChild("Fcolumn12", new LocaleValue("拖期数量"), SqlStorageType.Sqlvarchar).ColIndex = 11;
            header.AddChild("Fcolumn13", new LocaleValue("T数量"), SqlStorageType.Sqlvarchar).ColIndex = 12;
            header.AddChild("Fcolumn14", new LocaleValue("T+1数量"), SqlStorageType.Sqlvarchar).ColIndex = 13;
            header.AddChild("Fcolumn15", new LocaleValue("T+2数量"), SqlStorageType.Sqlvarchar).ColIndex = 14;
            header.AddChild("Fcolumn16", new LocaleValue("T+3数量"), SqlStorageType.Sqlvarchar).ColIndex = 15;
            header.AddChild("Fcolumn17", new LocaleValue("T+4数量"), SqlStorageType.Sqlvarchar).ColIndex = 16;
            header.AddChild("Fcolumn18", new LocaleValue("T+5数量"), SqlStorageType.Sqlvarchar).ColIndex = 17;
            header.AddChild("Fcolumn19", new LocaleValue("T+6数量"), SqlStorageType.Sqlvarchar).ColIndex = 18;
            header.AddChild("Fcolumn20", new LocaleValue("T+7数量"), SqlStorageType.Sqlvarchar).ColIndex = 19;
            header.AddChild("Fcolumn21", new LocaleValue("T合计")).ColIndex = 20;
            header.AddChild("Fcolumn22", new LocaleValue("拖期计划数量"), SqlStorageType.Sqlvarchar).ColIndex = 21;
            header.AddChild("Fcolumn23", new LocaleValue("T计划数量"), SqlStorageType.Sqlvarchar).ColIndex = 22;
            header.AddChild("Fcolumn24", new LocaleValue("T+1计划数量"), SqlStorageType.Sqlvarchar).ColIndex = 23;
            header.AddChild("Fcolumn25", new LocaleValue("T+2计划数量"), SqlStorageType.Sqlvarchar).ColIndex = 24;
            header.AddChild("Fcolumn26", new LocaleValue("T+3计划数量"), SqlStorageType.Sqlvarchar).ColIndex = 25;
            header.AddChild("Fcolumn27", new LocaleValue("T+4计划数量"), SqlStorageType.Sqlvarchar).ColIndex = 26;
            header.AddChild("Fcolumn28", new LocaleValue("T+5计划数量"), SqlStorageType.Sqlvarchar).ColIndex = 27;
            header.AddChild("Fcolumn29", new LocaleValue("T+6计划数量"), SqlStorageType.Sqlvarchar).ColIndex = 28;
            header.AddChild("Fcolumn30", new LocaleValue("T+7计划数量"), SqlStorageType.Sqlvarchar).ColIndex = 29;
            header.AddChild("Fcolumn31", new LocaleValue("T计划合计")).ColIndex = 30;
            //header.AddChild("Fcolumn41", new LocaleValue("老厂仓库")).ColIndex = 31;
            //header.AddChild("Fcolumn42", new LocaleValue("新厂仓库")).ColIndex = 32;
 
            return header;
 
            return header;
        }
 
        public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
        {
            base.BuilderReportSqlAndTempTable(filter, tableName);
 
            DynamicObject customFil = filter.FilterParameter.CustomFilter;
            string FMateriel = ""; //物料
            string FMaterielName = "";//物料名称
            string FModel = "";//规格型号
            string FSupplier = "0";//供应商 默认值为0
            string FOrgId = "100092"; //组织(默认取值当前组织)
            string FFactoryArea = ""; //厂区
            string FBuyer = ""; //采购员
            string FWarehouse = "";//仓库
            bool FIsMainMaterial = Convert.ToBoolean(customFil["FIsMainMaterial"]);//True False//是否主料
            bool FIsTq = Convert.ToBoolean(customFil["FIsTq"]);//True False//是否拖期
            bool FIsXBC = Convert.ToBoolean(customFil["FIsXBC"]);//True False//是否线边仓
            bool FIsZZ = Convert.ToBoolean(customFil["FIsZZ"]);//True False//是否显示所有物料
 
            if (((DynamicObject)customFil["FMateriel"]) != null)
            {
                FMateriel = ((DynamicObject)customFil["FMateriel"])["Number"].ToString();
                FMaterielName = ((DynamicObject)customFil["FMateriel"])["Name"].ToString();
                FModel = ((DynamicObject)customFil["FMateriel"])["Specification"].ToString();
 
            }
            if (((DynamicObject)customFil["FSupplier"]) != null)
            {
                FSupplier = ((DynamicObject)customFil["FSupplier"])["Id"].ToString();
            }
            if (((DynamicObject)customFil["FFactoryArea"]) != null)
            {
                FFactoryArea = ((DynamicObject)customFil["FFactoryArea"])["Id"].ToString();
            }
            if (((DynamicObject)customFil["FBuyer"]) != null)
            {
                FBuyer = ((DynamicObject)customFil["FBuyer"])["Id"].ToString();
            }
            if (((DynamicObject)customFil["FWarehouse"]) != null)
            {
                FWarehouse = ((DynamicObject)customFil["FWarehouse"])["Id"].ToString();
            }
          
            if (((DynamicObject)customFil["FOrgId"]) != null)
            {
                FOrgId = ((DynamicObject)customFil["FOrgId"])["Id"].ToString();
 
            }
            string sql = string.Format(@"/*dialect*/ 
            exec [h_p_Cg_SupSendGoodsPlanZSF] '{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}' ,'{11}'  ,'{12}' 
", FSupplier, FOrgId, FFactoryArea, FMateriel, FMaterielName, FModel, FBuyer, FWarehouse, FIsMainMaterial ? 1 : 0, FIsXBC ? 1 : 0, FIsTq ? 1 : 0, FIsZZ ? 1 : 0, tableName);
            LogHelper.Info(sql);
            DBUtils.Execute(this.Context, sql);
            //EXEC h_p_Cg_SupSendGoodsPlanZSF 0,100092,'5fe5d920a3f2bf','','','',382467,0,1,1
        }
        public override void CloseReport()
        {
 
        }
    }
}