IT-KIMI_SHI\SINOIT.KIMI
2018-06-01 64c40fb427bff513f575f11e4c1e7bd9a1bfe3e3
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sql PUBLIC "sql" "../config/sql.dtd" >
 
<sqls>
 
    <dataSpace name="getList">
        <sql name="getPurchase">
            <![CDATA[
              select 
              ROW_NUMBER() OVER(order by [BizDate] desc) as rownum, *
              from (
              SELECT 
                  [Id],
                  [BizDate],
                  [VendorCode],
                  [VendorName],
                  [RawVendorName]
                  [VendorProvince],
                  [VendorCity],
                  [VendorType],
                  [DistributorCode],
                  [DistributorName],
                  [DistributorLevel],
                  [DistributorProvince],
                  [DistributorCity],
                  [ProductCode],
                  [ProductName],
                  [Specification],
                  [LotNo],
                  [Quantity],
                  [UnitName],
                  [dbo].[GetSeparatorThousandMoney]([RawPrice],1) AS [RawPrice],
                  [dbo].[GetSeparatorThousandMoney]([RawAmount],1) AS [RawAmount],
                  [dbo].[GetSeparatorThousandMoney]([Price],1) AS [Price],
                  [dbo].[GetSeparatorThousandMoney]([Amount],1) AS [Amount],
                  [Manufacturer],
                  [RawSpecification],
                  [AdditionalNote],
                  [RecordNo],
                  [CreateTime]
                  FROM [dbo].[VIEW_DataPurchase]  as DATA 
                  ) tb
              where @{filter}   AND DistributorLevel ='一级商' 
            ]]>
        </sql>
            
        <sql name="getSales">
            <![CDATA[
                select
                ROW_NUMBER() OVER(order by [BizDate] desc) as rownum, *
                from (
                SELECT 
                    [BizDate] ,
                    DATA.[DistributorCode] ,
                    DATA.[DistributorName] as distributorname,
                    DATA.[DistributorLevel] ,
                    D.DistributorCode AS AscriptionCode ,
                    D.DistributorName AS AscriptionName ,
                    [CustomerCode] ,
                    C.Family ,
                    [CustomerName] ,
                    [CustomerType] ,
                    DATA.[ProductCode] ,
                    DATA.[ProductName] ,
                    P.ProductType ,
                    [Quantity] ,
                    [dbo].[GetSeparatorThousandMoney](DATA.[Price], 1) AS [Price] ,
                    [dbo].[GetSeparatorThousandMoney]([Amount], 1) AS [Amount] ,
                    [dbo].[GetSeparatorThousandMoney]([RawPrice], 1) AS [RawPrice] ,
                    [dbo].[GetSeparatorThousandMoney]([RawAmount], 1) AS [RawAmount] ,
                    [CustomerProvince] ,
                    [CustomerCity] ,
                       DATA.[Specification] ,
                    [LotNo] ,
                    [UnitName] ,
                    DATA.[Manufacturer] ,
                    [CustomerAddress] ,
                    [RawSpecification]
                    FROM  [dbo].[VIEW_DataSales] AS DATA
                    LEFT  JOIN [dbo].[DistributorRelationship] DRS ON DRS.SubDistributorCode = DATA.DistributorCode
                    LEFT  JOIN dbo.Distributor D ON D.DistributorCode = DRS.DistributorCode
                    LEFT  JOIN dbo.Company C ON C.CompanyCode = DATA.CustomerCode
                    LEFT  JOIN dbo.Product P ON P.ProductCode = DATA.ProductCode
                    ) tb
                WHERE   @{filter}  
            ]]>
        </sql>
        
        <sql name="getInventory">
            <![CDATA[
             select
             ROW_NUMBER() OVER(order by [BizDate] desc) as rownum, * 
             from (
             SELECT
               * 
               FROM [STRInterface].[dbo].[VIEW_DataInventory] as DATA 
               )tb
               where @{filter} 
            ]]>
        </sql>
        
        <sql name="getCustomerType">
            <![CDATA[
                             select DISTINCT
                CustomerType
                from (
                SELECT 
                    [BizDate] ,
                    DATA.[DistributorCode] ,
                    DATA.[DistributorName] as distributorname,
                    DATA.[DistributorLevel] ,
                    D.DistributorCode AS AscriptionCode ,
                    D.DistributorName AS AscriptionName ,
                    [CustomerCode] ,
                    C.Family ,
                    [CustomerName] ,
                    [CustomerType] ,
                    DATA.[ProductCode] ,
                    DATA.[ProductName] ,
                    P.ProductType ,
                    [Quantity] ,
                    [dbo].[GetSeparatorThousandMoney](DATA.[Price], 1) AS [Price] ,
                    [dbo].[GetSeparatorThousandMoney]([Amount], 1) AS [Amount] ,
                    [dbo].[GetSeparatorThousandMoney]([RawPrice], 1) AS [RawPrice] ,
                    [dbo].[GetSeparatorThousandMoney]([RawAmount], 1) AS [RawAmount] ,
                    [CustomerProvince] ,
                    [CustomerCity] ,
                       DATA.[Specification] ,
                    [LotNo] ,
                    [UnitName] ,
                    DATA.[Manufacturer] ,
                    [CustomerAddress] ,
                    [RawSpecification]
                    FROM  [dbo].[VIEW_DataSales] AS DATA
                    LEFT  JOIN [dbo].[DistributorRelationship] DRS ON DRS.SubDistributorCode = DATA.DistributorCode
                    LEFT  JOIN dbo.Distributor D ON D.DistributorCode = DRS.DistributorCode
                    LEFT  JOIN dbo.Company C ON C.CompanyCode = DATA.CustomerCode
                    LEFT  JOIN dbo.Product P ON P.ProductCode = DATA.ProductCode
                    ) tb
                WHERE   @{filter} 
            ]]>
        </sql>
    </dataSpace>    
    
</sqls>