王 垚
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
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 FeedPlanOrderDetailReport : 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();
            header.AddChild("FIDENTITYID", new LocaleValue("序号"));
            header.AddChild("Fcolumn2", new LocaleValue("日期"));
            header.AddChild("Fcolumn3", new LocaleValue("模块"));
            header.AddChild("Fcolumn4", new LocaleValue("部门 / 供应商 / 仓库"));
            header.AddChild("Fcolumn5", new LocaleValue("旧物料代码"));
            header.AddChild("Fcolumn6", new LocaleValue("物料代码"));
            header.AddChild("Fcolumn7", new LocaleValue("物料名称"));
            header.AddChild("Fcolumn8", new LocaleValue("规格型号"));
            header.AddChild("Fcolumn9", new LocaleValue("数量"));
            header.AddChild("Fcolumn10", new LocaleValue("厂区"));
           // header.AddChild("Fcolumn11", new LocaleValue("单据号"));
           // header.AddChild("Fcolumn12", new LocaleValue("销售订单号"));
            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 = false;//是否主料
            string saleOrderNo = "";//采购订单号
            //5fe5d920a3f2bf
            //5fe5d926a3f2c1
            //5fe5d92ca3f2c3
 
 
 
            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"])["Number"].ToString();
            }
            if (((DynamicObject)customFil["FFactoryArea"]) != null)
            {
                FFactoryArea = ((DynamicObject)customFil["FFactoryArea"])["Id"].ToString();
            }
            if ((customFil["FSaleOrderNo"]) != null)
            {
                saleOrderNo = customFil["FSaleOrderNo"].ToString();
            }
            if (((DynamicObject)customFil["FOrgId"]) != null)
            {
                FOrgId = ((DynamicObject)customFil["FOrgId"])["Id"].ToString();
            }
            //跳转框赋值 (物料编码 + 仓库FentryID)
            LogHelper.Info("物料:"+ FMateriel);
            LogHelper.Info("厂区:"+FFactoryArea);
 
            if ((customFil["Fmaterial"]) != null && FMateriel == "")
            {
                FMateriel = customFil["Fmaterial"].ToString();
                LogHelper.Info("FMateriel:" + FMateriel);
 
            }
            if ((customFil["Fstockid"]) != null && FFactoryArea == "")
            {
                FFactoryArea = customFil["Fstockid"].ToString();
                LogHelper.Info("FFactoryArea:" + FFactoryArea);
 
            }
            string sql = string.Format(@"/*dialect*/ 
            exec [h_p_Cg_SupSendGoodsPlanZSFMXDD] '{0}','{1}','{2}','{3}','{4}','{5}','{6}' ,'{7}'
", FSupplier, FOrgId, FFactoryArea, FMateriel, FMaterielName, FModel, saleOrderNo, tableName);
            LogHelper.Info(sql);
            DBUtils.Execute(this.Context, sql);
            //EXEC h_p_Cg_SupSendGoodsPlanZSFMXDD 0,100092,'5fe5d926a3f2c1','1.00.002.1647','','','W595801'
        }
        public override void CloseReport()
        {
 
        }
    }
}