jt
2021-06-10 5d0d028456874576560552f5a5c4e8b801786f11
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
using GrapeCity.ActiveReports;
using GrapeCity.ActiveReports.Web;
using HH.WMS.Entitys;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
 
namespace HH.WMS.WebUI.ActiveReport.Service
{
    /// <summary>
    /// SortingService 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class SortingService : ReportService
    {
        protected override object OnCreateReportHandler(string reportPath)
        {
            //通过report的值获取数据源
            var instance = base.OnCreateReportHandler(reportPath);
            var pageReport = instance as PageReport;
            if (pageReport != null)
            {
                pageReport.Document.LocateDataSource += Document_LocateDataSource;
            }
            return instance;
        }
 
        void Document_LocateDataSource(object sender, LocateDataSourceEventArgs args)
        {
            string no = args.Report.Parameters["no"].CurrentValue.ToString();
            string tokenId = args.Report.Parameters["tokenId"].CurrentValue.ToString();
            if (args.DataSourceName == "SortingDS")
            {
                if (args.DataSetName == "DataSet_MST")
                {
                    args.Data = GetMst(tokenId, no);
                }
                else if (args.DataSetName == "DataSet_DTL")
                {
                    args.Data = GetDtl(tokenId, no);
                }
            }
        }
 
        //获取到货单主表
        public DataTable GetMst(string tokenId, string no)
        {
            string list = HH.WMS.Common.WebApiManager.HttpWMS_Get("Api/Sorting/GetSortingModel?tokenId=" + tokenId + "&sortingNo=" + no);
 
            OperateResult or = JsonConvert.DeserializeObject<OperateResult>(list);
            if (or.Status == ResultStatus.Success)
                return JsonConvert.DeserializeObject<DataTable>("[" + or.Data.ToString() + "]");
            return new DataTable();
        }
 
        public DataTable GetDtl(string tokenId, string no)
        {
            string list = HH.WMS.Common.WebApiManager.HttpWMS_Get("Api/Sorting/GetCurrentSortingLocation?tokenId=" + tokenId + "&sortingNo=" + no);
            OperateResult or = JsonConvert.DeserializeObject<OperateResult>(list);
            if (or.Status == ResultStatus.Success)
                return JsonConvert.DeserializeObject<DataTable>(or.Data.ToString());
            return new DataTable();
        }
    }
}