ReceiptDetailMapper.xml
10.3 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.huaheng.pc.receipt.receiptDetail.mapper.ReceiptDetailMapper">
<resultMap id="BaseResultMap" type="com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail">
<!--@mbg.generated-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="receiptId" jdbcType="INTEGER" property="receiptId" />
<result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
<result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
<result column="receiptCode" jdbcType="VARCHAR" property="receiptCode" />
<result column="materialCode" jdbcType="VARCHAR" property="materialCode" />
<result column="materialName" jdbcType="VARCHAR" property="materialName" />
<result column="materialSpec" jdbcType="VARCHAR" property="materialSpec" />
<result column="materialUnit" jdbcType="VARCHAR" property="materialUnit" />
<result column="supplierCode" jdbcType="VARCHAR" property="supplierCode" />
<result column="batch" jdbcType="VARCHAR" property="batch" />
<result column="lot" jdbcType="VARCHAR" property="lot" />
<result column="qcCheck" jdbcType="VARCHAR" property="qcCheck" />
<result column="projectNo" jdbcType="VARCHAR" property="projectNo" />
<result column="manufactureDate" jdbcType="TIMESTAMP" property="manufactureDate" />
<result column="expirationDate" jdbcType="TIMESTAMP" property="expirationDate" />
<result column="agingDate" jdbcType="TIMESTAMP" property="agingDate" />
<result column="attributeTemplateCode" jdbcType="VARCHAR" property="attributeTemplateCode" />
<result column="attribute1" jdbcType="VARCHAR" property="attribute1" />
<result column="attribute2" jdbcType="VARCHAR" property="attribute2" />
<result column="attribute3" jdbcType="VARCHAR" property="attribute3" />
<result column="attribute4" jdbcType="VARCHAR" property="attribute4" />
<result column="totalWeight" jdbcType="DECIMAL" property="totalWeight" />
<result column="openWeight" jdbcType="DECIMAL" property="openWeight" />
<result column="totalQty" jdbcType="DECIMAL" property="totalQty" />
<result column="unitId1Qty" jdbcType="DECIMAL" property="unitId1Qty" />
<result column="unitId2Qty" jdbcType="DECIMAL" property="unitId2Qty" />
<result column="unitId1" jdbcType="VARCHAR" property="unitId1" />
<result column="unitId2" jdbcType="VARCHAR" property="unitId2" />
<result column="multiple" jdbcType="DOUBLE" property="multiple" />
<result column="openQty" jdbcType="DECIMAL" property="openQty" />
<result column="referCode" jdbcType="VARCHAR" property="referCode" />
<result column="referId" jdbcType="INTEGER" property="referId" />
<result column="referLineNum" jdbcType="VARCHAR" property="referLineNum" />
<result column="locatingRule" jdbcType="VARCHAR" property="locatingRule" />
<result column="inventorySts" jdbcType="VARCHAR" property="inventorySts" />
<result column="itemListPrice" jdbcType="DECIMAL" property="itemListPrice" />
<result column="itemNetPrice" jdbcType="DECIMAL" property="itemNetPrice" />
<result column="isVirtualBom" jdbcType="INTEGER" property="isVirtualBom" />
<result column="created" jdbcType="TIMESTAMP" property="created" />
<result column="createdBy" jdbcType="VARCHAR" property="createdBy" />
<result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" />
<result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" />
<result column="version" jdbcType="INTEGER" property="version" />
<result column="userDef1" jdbcType="VARCHAR" property="userDef1" />
<result column="userDef2" jdbcType="VARCHAR" property="userDef2" />
<result column="userDef3" jdbcType="VARCHAR" property="userDef3" />
<result column="userDef4" jdbcType="VARCHAR" property="userDef4" />
<result column="userDef5" jdbcType="VARCHAR" property="userDef5" />
<result column="userDef6" jdbcType="VARCHAR" property="userDef6" />
<result column="userDef7" jdbcType="VARCHAR" property="userDef7" />
<result column="userDef8" jdbcType="VARCHAR" property="userDef8" />
<result column="processStamp" jdbcType="VARCHAR" property="processStamp" />
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="statusFlowCode" jdbcType="VARCHAR" property="statusFlowCode" />
<result column="vin" jdbcType="VARCHAR" property="vin" />
<result column="scrapTime" jdbcType="TIMESTAMP" property="scrapTime" />
<result column="batteryPackageCode" jdbcType="VARCHAR" property="batteryPackageCode" />
<!-- <result column="batteryType" jdbcType="VARCHAR" property="batteryType" />-->
<result column="otherType" jdbcType="VARCHAR" property="otherType" />
<result column="batteryCode" jdbcType="VARCHAR" property="batteryCode" />
<result column="sourceEnterpriseName" jdbcType="VARCHAR" property="sourceEnterpriseName" />
<result column="sourceEnterpriseCode" jdbcType="VARCHAR" property="sourceEnterpriseCode" />
<result column="batteryTypes" jdbcType="VARCHAR" property="batteryTypes" />
<result column="batteryQty" jdbcType="TIMESTAMP" property="batteryQty" />
<result column="statusFlowCode" jdbcType="VARCHAR" property="statusFlowCode" />
<result column="orderNo" jdbcType="VARCHAR" property="orderNo" />
<result column="countryCode" jdbcType="VARCHAR" property="countryCode" />
<result column="batteryPackTwoCode" jdbcType="VARCHAR" property="batteryPackTwoCode" />
<result column="recoveryDate" jdbcType="DATE" property="recoveryDate" />
<result column="recycler" jdbcType="VARCHAR" property="recycler" />
<result column="manufactureData" jdbcType="DATE" property="manufactureData" />
<result column="manufacturerOneCode" jdbcType="VARCHAR" property="manufacturerOneCode" />
<result column="manufacturerTwoCode" jdbcType="VARCHAR" property="manufacturerTwoCode" />
<result column="batteryPackType" jdbcType="VARCHAR" property="batteryPackType" />
<result column="completeness" jdbcType="VARCHAR" property="completeness" />
<result column="storageShelf" jdbcType="VARCHAR" property="storageShelf" />
<result column="grossWeight" jdbcType="DECIMAL" property="grossWeight" />
<result column="tareWeight" jdbcType="DECIMAL" property="tareWeight" />
<result column="materialBatch" jdbcType="VARCHAR" property="materialBatch" />
<result column="receiptWarehouse" jdbcType="VARCHAR" property="receiptWarehouse" />
<result column="electricQuantity" jdbcType="DECIMAL" property="electricQuantity" />
<result column="materialNetWeight" jdbcType="DECIMAL" property="materialNetWeight" />
<result column="materialTareWeight" jdbcType="DECIMAL" property="materialTareWeight" />
<result column="materialGrossWeight" jdbcType="DECIMAL" property="materialGrossWeight" />
<result column="barcodeDetailsId" jdbcType="INTEGER" property="barcodeDetailsId" />
<result column="barcodeDetailsCode" jdbcType="VARCHAR" property="barcodeDetailsCode" />
<result column="oldBatterySource" jdbcType="VARCHAR" property="oldBatterySource" />
<result column="allCreditCode" jdbcType="VARCHAR" property="allCreditCode" />
<result column="materialIsBattery" jdbcType="INTEGER" property="materialIsBattery" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="storageType" jdbcType="INTEGER" property="storageType" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, receiptId,warehouseCode, companyCode, receiptCode, materialCode, materialName, materialSpec, materialUnit,
supplierCode, batch, lot, qcCheck, projectNo, manufactureDate, expirationDate, agingDate,
vin,scrapTime,batteryPackageCode,otherType,batteryCode,sourceEnterpriseName,
sourceEnterpriseCode,batteryTypes,oldBatterySource,allCreditCode,
batteryQty,statusFlowCode,orderNo,countryCode,
attributeTemplateCode, attribute1, attribute2, attribute3, attribute4, totalQty,unitId1Qty,unitId2Qty,
openQty, referCode, referId, referLineNum,locatingRule,inventorySts,itemListPrice,unitId1,unitId2,multiple,
itemNetPrice, isVirtualBom, created, createdBy, lastUpdated, lastUpdatedBy,totalWeight,openWeight,
version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8,electricQuantity,
batteryPackTwoCode,recoveryDate,recycler,manufactureData,manufacturerOneCode,manufacturerTwoCode,batteryPackType,completeness,storageShelf,
processStamp, deleted,statusFlowCode,grossWeight,tareWeight,materialBatch,receiptWarehouse,materialNetWeight,materialTareWeight,materialGrossWeight,storageType,`type`
</sql>
<select id="getReceiptQtyLast7Days" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail">
SELECT
a.click_date AS lastUpdated,
ifnull( b.taskQty, 0 ) AS qty
FROM
(
SELECT
curdate( ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 1 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 2 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 3 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 4 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 5 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 6 DAY ) AS click_date
) a
LEFT JOIN (
SELECT
DATE( r.lastUpdated ) AS date,
SUM( r.qty ) AS taskQty
FROM
task_detail r
WHERE
r.taskType = 100 and
r.lastUpdated >= DATE_SUB( CURDATE( ), INTERVAL 7 DAY )
AND r.status>90
GROUP BY
DATE(r.lastUpdated )
) b ON a.click_date = b.date
ORDER BY
a.click_date;
</select>
<select id="getWarehouseReceipt" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail">
SELECT ifnull(sum(r.qty),0) as qty,w.name as warehouseName from warehouse w
left JOIN task_detail r on r.warehouseCode=w.code and r.status>90 and r.taskType =100
and date(r.lastUpdated)=CURDATE() group by w.code
</select>
<select id="getCompanyReceipt" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail">
SELECT ifnull(sum(r.qty),0) as qty,c.name as companyName from company c
left JOIN task_detail r on r.companyCode=c.code and r.status>90 and r.taskType =100
and date(r.lastUpdated)=CURDATE() group by c.code
</select>
</mapper>