Browse Source

库存记录报表月维度改为日维度

master
psh 4 months ago
parent
commit
8b51613571
  1. 68
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/dao/mapper/MaterialDataMapper.xml
  2. 4
      lms/nladmin-ui/src/views/wms/sch/data/index.vue

68
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/dao/mapper/MaterialDataMapper.xml

@ -8,13 +8,13 @@
<select id="queryAll" resultType="org.nl.wms.sch.data.service.dto.MaterialDataResponse"> <select id="queryAll" resultType="org.nl.wms.sch.data.service.dto.MaterialDataResponse">
SELECT SELECT
supplierCode, supplierCode,
MAX(md.supplierName) AS supplierName, MAX(md.supplierName) AS supplierName,
productName, productName,
specification, specification,
MAX(batch) AS batch, MAX(batch) AS batch,
MAX(barLevel) AS barLevel, MAX(barLevel) AS barLevel,
DATE_FORMAT(md.createTime, '%Y-%m') AS date, DATE_FORMAT(md.createTime, '%Y-%m-%d') AS date,
COALESCE(SUM(CASE WHEN md.type = 1 THEN md.length ELSE 0 END), 0) AS ll_length, COALESCE(SUM(CASE WHEN md.type = 1 THEN md.length ELSE 0 END), 0) AS ll_length,
COALESCE(SUM(CASE WHEN md.type = 1 THEN md.weight ELSE 0 END), 0) AS ll_weight, COALESCE(SUM(CASE WHEN md.type = 1 THEN md.weight ELSE 0 END), 0) AS ll_weight,
COALESCE(SUM(CASE WHEN md.type = 2 THEN md.length ELSE 0 END), 0) AS sc_length, COALESCE(SUM(CASE WHEN md.type = 2 THEN md.length ELSE 0 END), 0) AS sc_length,
@ -26,37 +26,37 @@
WHERE WHERE
supplierCode = md.supplierCode AND supplierCode = md.supplierCode AND
createTime <![CDATA[ < ]]> DATE_FORMAT(DATE_SUB(CONCAT(YEAR(#{query.start_time}), '-', MONTH(#{query.start_time}), '-01'), INTERVAL 1 DAY), '%Y-%m-%d') createTime <![CDATA[ < ]]> DATE_FORMAT(DATE_SUB(CONCAT(YEAR(#{query.start_time}), '-', MONTH(#{query.start_time}), '-01'), INTERVAL 1 DAY), '%Y-%m-%d')
), 0) AS sy_length, ), 0) AS sy_length,
COALESCE( COALESCE(
(SELECT (SELECT
SUM(CASE WHEN type = 1 THEN weight ELSE 0 END) - SUM(CASE WHEN type = 2 THEN weight ELSE 0 END) SUM(CASE WHEN type = 1 THEN weight ELSE 0 END) - SUM(CASE WHEN type = 2 THEN weight ELSE 0 END)
FROM material_data FROM material_data
WHERE WHERE
supplierCode = md.supplierCode AND supplierCode = md.supplierCode AND
createTime <![CDATA[ < ]]> DATE_FORMAT(DATE_SUB(CONCAT(YEAR(#{query.start_time}), '-', MONTH(#{query.start_time}), '-01'), INTERVAL 1 DAY), '%Y-%m-%d') createTime <![CDATA[ < ]]> DATE_FORMAT(DATE_SUB(CONCAT(YEAR(#{query.start_time}), '-', DAY(#{query.start_time}), '-01'), INTERVAL 1 DAY), '%Y-%m-%d')
), 0) AS sy_weight, ), 0) AS sy_weight,
COALESCE( COALESCE(
(SELECT (SELECT
SUM(CASE WHEN type = 1 THEN length ELSE 0 END) - SUM(CASE WHEN type = 2 THEN length ELSE 0 END) SUM(CASE WHEN type = 1 THEN length ELSE 0 END) - SUM(CASE WHEN type = 2 THEN length ELSE 0 END)
FROM material_data FROM material_data
WHERE WHERE
supplierCode = md.supplierCode and productName = md.productName and specification = md.specification supplierCode = md.supplierCode and productName = md.productName and specification = md.specification
), 0) AS jc_length, ), 0) AS jc_length,
COALESCE( COALESCE(
(SELECT (SELECT
SUM(CASE WHEN type = 1 THEN weight ELSE 0 END) - SUM(CASE WHEN type = 2 THEN weight ELSE 0 END) SUM(CASE WHEN type = 1 THEN weight ELSE 0 END) - SUM(CASE WHEN type = 2 THEN weight ELSE 0 END)
FROM material_data FROM material_data
WHERE WHERE
supplierCode = md.supplierCode and productName =md.productName and specification = md.specification supplierCode = md.supplierCode and productName =md.productName and specification = md.specification
), 0) AS jc_weight ), 0) AS jc_weight
FROM FROM
material_data md material_data md
WHERE WHERE
DATE_FORMAT(md.createTime, '%Y-%m') = DATE_FORMAT(#{query.start_time}, '%Y-%m') DATE_FORMAT(md.createTime, '%Y-%m-%d') = DATE_FORMAT(#{query.start_time}, '%Y-%m-%d')
GROUP BY GROUP BY
md.productName,md.specification,supplierCode, DATE_FORMAT(md.createTime, '%Y-%m') md.productName,md.specification,supplierCode, DATE_FORMAT(md.createTime, '%Y-%m-%d')
ORDER BY ORDER BY
md.supplierCode, md.productName md.supplierCode, md.productName
</select> </select>

4
lms/nladmin-ui/src/views/wms/sch/data/index.vue

@ -14,7 +14,7 @@
<el-date-picker <el-date-picker
v-model="query.start_time" v-model="query.start_time"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="month" type="date"
style="width: 240px;" style="width: 240px;"
placeholder="选择日期时间" placeholder="选择日期时间"
/> />
@ -44,7 +44,7 @@
<el-table-column prop="specification" label="规格" /> <el-table-column prop="specification" label="规格" />
<el-table-column prop="batch" label="来料批次" /> <el-table-column prop="batch" label="来料批次" />
<el-table-column prop="barLevel" label="棒源等级" /> <el-table-column prop="barLevel" label="棒源等级" />
<el-table-column label="上月结存"> <el-table-column label="昨日结存">
<el-table-column prop="sy_length" label="实际长度(mm)" /> <el-table-column prop="sy_length" label="实际长度(mm)" />
<el-table-column prop="sy_weight" label="实际重量(KG)" /> <el-table-column prop="sy_weight" label="实际重量(KG)" />
</el-table-column> </el-table-column>

Loading…
Cancel
Save