代码提交
This commit is contained in:
parent
3fe0fe901d
commit
3f42f95b41
|
|
@ -635,6 +635,7 @@
|
|||
|
||||
LEFT JOIN v_mtp_status vs on mm.ID = vs.maId
|
||||
WHERE 30> to_days(ifnull(mm.NEXT_CHECK_TIME,now())) - to_days(now())
|
||||
group by mm.ID
|
||||
|
||||
|
||||
</select>
|
||||
|
|
@ -691,20 +692,24 @@
|
|||
|
||||
<select id="getTotalChangeWarn" parameterType="com.bonus.index.beans.IndexTotalWarnBean" resultType="com.bonus.index.beans.IndexTotalWarnBean">
|
||||
SELECT
|
||||
mt.ID,
|
||||
mt2.`NAME` as maType,
|
||||
mt.`NAME` as maName,
|
||||
mt.UNIT as maUnit,
|
||||
mt.is_count as isCount,
|
||||
t1.TIME as time,
|
||||
t1.content
|
||||
mt.ID,
|
||||
mt2.`NAME` AS maType,
|
||||
mt.`NAME` AS maName,
|
||||
mt.UNIT AS maUnit,
|
||||
mt.is_count AS isCount,
|
||||
t1.TIME AS time,
|
||||
t1.content
|
||||
FROM ma_total_change t1
|
||||
LEFT JOIN mm_type mt on mt.ID = t1.type_id
|
||||
LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM ma_total_change t2
|
||||
WHERE t2.type_id = t1.type_id AND t2.time > t1.time
|
||||
LEFT JOIN mm_type mt ON mt.ID = t1.type_id
|
||||
LEFT JOIN mm_type mt2 ON mt.PARENT_ID = mt2.ID
|
||||
WHERE
|
||||
DATEDIFF(NOW(), t1.time) < 30
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM ma_total_change t2
|
||||
WHERE
|
||||
t2.type_id = t1.type_id
|
||||
AND t2.time > t1.time
|
||||
)
|
||||
<if test="maType != null and maType != ''">
|
||||
and mt2.`NAME` like concat('%', #{maType}, '%')
|
||||
|
|
@ -1369,25 +1374,27 @@
|
|||
|
||||
<select id="getPlanDetailsAboutExpireList" resultType="com.bonus.index.beans.IndexInuseWarnBean">
|
||||
SELECT
|
||||
'车辆需求计划' as type,
|
||||
cpd.id,
|
||||
bp.`NAME` as projectName,
|
||||
cpd.model_id modelId,
|
||||
cpd.need_num needNum,
|
||||
cpd.need_day needDay,
|
||||
cpa.need_time backDate,
|
||||
cpd.remark,
|
||||
cmti.type maType,
|
||||
cmti.`NAME` maName,
|
||||
cmti.model maModel,
|
||||
cmti.unit maUnit
|
||||
'车辆需求计划' as type,
|
||||
cpd.id,
|
||||
bp.`NAME` as projectName,
|
||||
cpd.model_id modelId,
|
||||
cpd.need_num needNum,
|
||||
cpd.need_day needDay,
|
||||
cpa.need_time backDate,
|
||||
cpd.remark,
|
||||
cmti.type maType,
|
||||
cmti.`NAME` maName,
|
||||
cmti.model maModel,
|
||||
cmti.unit maUnit
|
||||
FROM
|
||||
car_plan_details cpd
|
||||
LEFT JOIN car_plan_apply cpa ON cpd.apply_id = cpa.id
|
||||
LEFT JOIN bm_project bp ON cpa.pro_id = bp.ID
|
||||
LEFT JOIN car_ma_type_info cmti ON cpd.model_id = cmti.id
|
||||
car_plan_details cpd
|
||||
LEFT JOIN car_plan_apply cpa ON cpd.apply_id = cpa.id
|
||||
LEFT JOIN bm_project bp ON cpa.pro_id = bp.ID
|
||||
LEFT JOIN car_ma_type_info cmti ON cpd.model_id = cmti.id
|
||||
WHERE bp.`NAME` IS NOT NULL
|
||||
and cpa.status = 1
|
||||
and cpa.status = 2
|
||||
and cpa.dispatch_num = 0
|
||||
and cpa.status_type = 1
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and bp.`NAME` like concat('%', #{projectName}, '%')
|
||||
</if>
|
||||
|
|
@ -1414,7 +1421,9 @@
|
|||
LEFT JOIN st_plan_apply spa ON spd.apply_id = spa.id
|
||||
LEFT JOIN bm_project bp ON spa.project_id = bp.ID
|
||||
WHERE bp.`NAME` IS NOT NULL
|
||||
and spa.status = 1
|
||||
and spa.status = 2
|
||||
and spa.ck_num = 0
|
||||
and spa.status_type = 1
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and bp.`NAME` like concat('%', #{projectName}, '%')
|
||||
</if>
|
||||
|
|
@ -1442,7 +1451,8 @@
|
|||
LEFT JOIN t_plan_apply tpa on tpa.id=tpd.apply_id
|
||||
LEFT JOIN bm_project pro on tpa.project_id=pro.ID
|
||||
WHERE pro.`NAME` is not null
|
||||
and tpa.status = 1
|
||||
and tpa.status = 2
|
||||
and tpa.status_type = 1
|
||||
<if test="maName != null and maName != ''">
|
||||
and tpd.`NAME` like concat('%', #{maName}, '%')
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
<mapper namespace="com.bonus.index.dao.IndexHomeDao" >
|
||||
|
||||
<resultMap id="index" type="com.bonus.index.beans.IndexHomeBean">
|
||||
<id column="id" property="id" />
|
||||
<result column="projectNum" property="partOne.projectCount" />
|
||||
<result column="maTypeNum" property="partOne.equipmentTypes" />
|
||||
<result column="maTotalNum" property="partOne.totalCount" />
|
||||
<result column="maStorageNum" property="partOne.stockCount" />
|
||||
<result column="maUseNum" property="partOne.inUseCount" />
|
||||
<result column="maRepairNum" property="partOne.repairCount" />
|
||||
<result column="maScrapNum" property="partOne.scrappedCount" />
|
||||
<id column="id" property="id" />
|
||||
<result column="projectNum" property="partOne.projectCount" />
|
||||
<result column="maTypeNum" property="partOne.equipmentTypes" />
|
||||
<result column="maTotalNum" property="partOne.totalCount" />
|
||||
<result column="maStorageNum" property="partOne.stockCount" />
|
||||
<result column="maUseNum" property="partOne.inUseCount" />
|
||||
<result column="maRepairNum" property="partOne.repairCount" />
|
||||
<result column="maScrapNum" property="partOne.scrappedCount" />
|
||||
<result column="newInputNum" property="partTwo.newStorage.value" />
|
||||
<result column="newTotal" property="partTwo.newStorage.total" />
|
||||
<result column="repairInputNum" property="partTwo.repairStorage.value" />
|
||||
|
|
@ -27,18 +27,18 @@
|
|||
<result column="checkNum" property="partFour.checkNum" />
|
||||
<result column="useNum" property="partFour.useNum" />
|
||||
<result column="changeNum" property="partFour.changeNum" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<resultMap id="two" type="com.bonus.index.beans.PartTwoBean" >
|
||||
<id column="id" property="id" />
|
||||
|
||||
|
||||
<id column="id" property="id" />
|
||||
|
||||
|
||||
<result column="newInputNum" property="newStorage.value" />
|
||||
<result column="newTotal" property="newStorage.total" />
|
||||
<result column="repairInputNum" property="repairStorage.value" />
|
||||
|
|
@ -51,40 +51,40 @@
|
|||
<result column="slInputTotal" property="equipmentCount.total" />
|
||||
<result column="bmInputNum" property="deviceCount.value" />
|
||||
<result column="bmInputTotal" property="deviceCount.total" />
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
|
||||
<resultMap id="six" type="com.bonus.index.beans.PartSixBean" >
|
||||
<id column="date" property="date" />
|
||||
|
||||
<id column="date" property="date" />
|
||||
|
||||
<collection property="list" ofType="com.bonus.index.beans.PartSixBean">
|
||||
<id column="dtype" property="type" />
|
||||
<result column="leaseNum" property="leaseNum" />
|
||||
<result column="backNum" property="backNum" />
|
||||
<result column="checkNum" property="checkNum" />
|
||||
<result column="scrapNum" property="scrapNum" />
|
||||
<result column="inputNum" property="inputNum" />
|
||||
<result column="newNum" property="newNum" />
|
||||
<result column="bdNum" property="bdNum" />
|
||||
|
||||
|
||||
|
||||
</collection>
|
||||
|
||||
|
||||
<result column="leaseNum" property="leaseNum" />
|
||||
<result column="backNum" property="backNum" />
|
||||
<result column="checkNum" property="checkNum" />
|
||||
<result column="scrapNum" property="scrapNum" />
|
||||
<result column="inputNum" property="inputNum" />
|
||||
<result column="newNum" property="newNum" />
|
||||
<result column="bdNum" property="bdNum" />
|
||||
|
||||
|
||||
|
||||
</collection>
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getPartOneData" parameterType="com.bonus.index.beans.IndexHomeBean" resultMap="index">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
index_part_one
|
||||
ORDER BY id desc
|
||||
index_part_one
|
||||
ORDER BY id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getPartTwoData" parameterType="com.bonus.index.beans.IndexHomeBean" resultMap="index">
|
||||
SELECT
|
||||
pt.newInputNum,
|
||||
|
|
@ -104,14 +104,14 @@
|
|||
ORDER BY pt.ID desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getPartThreeData" parameterType="com.bonus.index.beans.IndexHomeBean" resultType="com.bonus.index.beans.PartThreeBean">
|
||||
SELECT
|
||||
id as id,
|
||||
projectName,
|
||||
SUM( leaseNum ) AS useCount,
|
||||
SUM( backNum ) AS returnCount,
|
||||
SUM( leaseNum ) - SUM( backNum ) diffCount
|
||||
SUM( leaseNum ) - SUM( backNum ) diffCount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
|
@ -120,18 +120,18 @@
|
|||
wla.`CODE` AS agreementCode,
|
||||
SUM( wir.NUM ) AS leaseNum,
|
||||
"0" AS backNum,
|
||||
wla.ID AS agreementId
|
||||
wla.ID AS agreementId
|
||||
FROM
|
||||
wf_task_record wtr
|
||||
LEFT JOIN wf_agreement_task wat ON wtr.ID = wat.TASK_ID
|
||||
LEFT JOIN wf_lease_agreement wla ON wat.AGREEMENT_ID = wla.ID
|
||||
|
||||
|
||||
LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID
|
||||
LEFT JOIN wf_task_record wte ON wtr.ID = wte.SUP_ID
|
||||
LEFT JOIN wf_info_record wir ON wte.ID = wir.SUP_ID
|
||||
LEFT JOIN wf_info_record wir ON wte.ID = wir.SUP_ID
|
||||
WHERE
|
||||
wir.TYPE = 2
|
||||
AND wtr.IS_ACTIVE = 1
|
||||
wir.TYPE = 2
|
||||
AND wtr.IS_ACTIVE = 1
|
||||
GROUP BY
|
||||
wla.ID UNION
|
||||
SELECT
|
||||
|
|
@ -140,7 +140,7 @@
|
|||
wla.`CODE` AS agreementCode,
|
||||
"0" AS leaseNum,
|
||||
SUM( wir.NUM ) AS backNum,
|
||||
wla.ID AS agreementId
|
||||
wla.ID AS agreementId
|
||||
FROM
|
||||
wf_task_record wtr
|
||||
LEFT JOIN wf_agreement_task wat ON wtr.ID = wat.TASK_ID
|
||||
|
|
@ -148,21 +148,21 @@
|
|||
|
||||
LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID
|
||||
LEFT JOIN wf_return_material_details wrd ON wtr.ID = wrd.TASK_ID
|
||||
LEFT JOIN wf_info_record wir ON wrd.ID = wir.SUP_ID
|
||||
LEFT JOIN wf_info_record wir ON wrd.ID = wir.SUP_ID
|
||||
WHERE
|
||||
wir.TYPE = 4
|
||||
AND wtr.IS_ACTIVE = 1
|
||||
wir.TYPE = 4
|
||||
AND wtr.IS_ACTIVE = 1
|
||||
GROUP BY
|
||||
wla.ID
|
||||
) a
|
||||
wla.ID
|
||||
) a
|
||||
GROUP BY
|
||||
a.projectName
|
||||
order by diffCount desc
|
||||
order by diffCount desc
|
||||
LIMIT 20
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getPartFourData" parameterType="com.bonus.index.beans.IndexHomeBean" resultMap="index">
|
||||
|
||||
|
||||
SELECT
|
||||
SUM(storageNum) as storageNum,
|
||||
SUM(checkNum) as checkNum,
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
0 as useNum,
|
||||
0 as changeNum
|
||||
FROM
|
||||
mm_type mt
|
||||
mm_type mt
|
||||
WHERE mt.`LEVEL` =4 and mt.NUM = 0 and mt.IS_ACTIVE = 1
|
||||
UNION
|
||||
SELECT
|
||||
|
|
@ -190,31 +190,40 @@
|
|||
mm.ID,
|
||||
to_days(ifnull(mm.NEXT_CHECK_TIME,now())) - to_days(now()) AS days
|
||||
FROM
|
||||
mm_machines mm
|
||||
) rs
|
||||
WHERE 30 > rs.days
|
||||
mm_machines mm
|
||||
) rs
|
||||
WHERE 30 > rs.days
|
||||
UNION
|
||||
|
||||
|
||||
SELECT
|
||||
0 AS storageNum,
|
||||
0 AS checkNum,
|
||||
COUNT(DISTINCT maId) as useNum,
|
||||
0 as changeNum
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
DISTINCT ps.machine as maId,
|
||||
to_days(now()) -to_days(ps.start_date) as days
|
||||
FROM
|
||||
ma_type_project_storage ps
|
||||
LEFT JOIN mm_machines mm on ps.machine = mm.ID
|
||||
WHERE ps.`status` =1 and ps.is_count = 0
|
||||
and mm.BATCH_STATUS = 6
|
||||
GROUP BY ps.machine
|
||||
) rs
|
||||
WHERE rs.days> 180
|
||||
0 AS storageNum,
|
||||
0 AS checkNum,
|
||||
COUNT(*) AS useNum,
|
||||
0 AS changeNum
|
||||
FROM (
|
||||
SELECT 1
|
||||
FROM
|
||||
ma_type_project_storage ps
|
||||
INNER JOIN mm_machines mm ON ps.machine = mm.ID
|
||||
INNER JOIN mm_type mt ON mm.TYPE = mt.ID
|
||||
LEFT JOIN mm_type mt2 ON mt.PARENT_ID = mt2.ID
|
||||
LEFT JOIN wf_lease_agreement wla ON ps.agreement_id = wla.ID
|
||||
LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID
|
||||
LEFT JOIN bm_company bc ON bp.COMPANY_ID = bc.ID
|
||||
WHERE
|
||||
ps.status = 1
|
||||
AND ps.end_date IS NULL
|
||||
AND mm.BATCH_STATUS = 6
|
||||
AND DATEDIFF(NOW(), ps.start_date) > 180
|
||||
GROUP BY
|
||||
mt.ID,
|
||||
mt2.ID,
|
||||
wla.ID,
|
||||
bp.ID,
|
||||
bc.ID
|
||||
) AS t
|
||||
UNION
|
||||
|
||||
|
||||
SELECT
|
||||
0 as storageNum,
|
||||
0 as checkNum,
|
||||
|
|
@ -224,14 +233,14 @@
|
|||
(
|
||||
SELECT
|
||||
mc.id,
|
||||
to_days(now()) -to_days(mc.time) as days
|
||||
to_days(now()) -to_days(mc.time) as days
|
||||
FROM
|
||||
ma_total_change mc
|
||||
) rs
|
||||
) rs
|
||||
WHERE rs.days < 30
|
||||
) res
|
||||
) res
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getPartFiveData" parameterType="com.bonus.index.beans.IndexHomeBean" resultType="com.bonus.index.beans.PartFiveBean">
|
||||
SELECT
|
||||
SUM(newNum) AS newNum,
|
||||
|
|
@ -240,7 +249,7 @@
|
|||
SUM(scrapNum) AS scrapNum
|
||||
FROM
|
||||
(
|
||||
|
||||
|
||||
SELECT
|
||||
COUNT(DISTINCT wd.TASK_ID) as newNum,
|
||||
0 as leaseNum,
|
||||
|
|
@ -248,10 +257,10 @@
|
|||
0 as scrapNum
|
||||
FROM
|
||||
wf_new_details wd
|
||||
|
||||
|
||||
WHERE wd.IS_APPROVAL = 0
|
||||
UNION
|
||||
|
||||
|
||||
SELECT
|
||||
0 as newNum,
|
||||
COUNT(DISTINCT wcd.TASK_ID) leaseNum,
|
||||
|
|
@ -259,7 +268,7 @@
|
|||
0 as scrapNum
|
||||
FROM
|
||||
wf_collar_details wcd
|
||||
|
||||
|
||||
WHERE wcd.IS_APPROVAL = 0 and wcd.IS_EXAMINE =1
|
||||
UNION
|
||||
SELECT
|
||||
|
|
@ -268,11 +277,11 @@
|
|||
COUNT(DISTINCT rm.TASK_ID) as backNum,
|
||||
0 as scrapNum
|
||||
FROM
|
||||
wf_return_material_details rm
|
||||
|
||||
wf_return_material_details rm
|
||||
|
||||
WHERE rm.IS_APPROVAL = 0
|
||||
UNION
|
||||
|
||||
|
||||
SELECT
|
||||
0 as newNum,
|
||||
0 as leaseNum,
|
||||
|
|
@ -281,12 +290,12 @@
|
|||
FROM
|
||||
wf_scrap_details ws
|
||||
WHERE ws.IS_SURE = 0
|
||||
|
||||
) res
|
||||
|
||||
|
||||
) res
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getPartSixData" parameterType="com.bonus.index.beans.IndexHomeBean" resultMap="six">
|
||||
SELECT A.date,
|
||||
SUM(IF(A.dtype = 2,A.leaseNum,0)) AS leaseNum,
|
||||
|
|
@ -304,16 +313,16 @@
|
|||
if(wi.TYPE = 5, SUM(wi.NUM),0) AS newNum,
|
||||
if(wi.TYPE = 3, SUM(wi.NUM),0) AS inputNum
|
||||
FROM
|
||||
wf_info_record wi
|
||||
|
||||
wf_info_record wi
|
||||
|
||||
WHERE LEFT(wi.TIME,7) = #{time}
|
||||
GROUP BY LEFT(wi.TIME,10),wi.TYPE
|
||||
) A
|
||||
) A
|
||||
GROUP BY A.date
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getOverview" parameterType="com.bonus.index.beans.IndexHomeBean" resultType="com.bonus.index.beans.PartOneBean">
|
||||
SELECT
|
||||
SUM(projectCount) projectCount,
|
||||
|
|
@ -325,8 +334,8 @@
|
|||
SUM(scrappedCount) scrappedCount
|
||||
FROM
|
||||
(
|
||||
|
||||
|
||||
|
||||
|
||||
SELECT
|
||||
COUNT( DISTINCT bp.ID ) AS projectCount,
|
||||
0 AS equipmentTypes,
|
||||
|
|
@ -334,9 +343,9 @@
|
|||
0 AS stockCount,
|
||||
0 AS inUseCount,
|
||||
0 AS repairCount,
|
||||
0 AS scrappedCount
|
||||
0 AS scrappedCount
|
||||
FROM
|
||||
bm_project bp
|
||||
bm_project bp
|
||||
WHERE
|
||||
bp.IS_ACTIVE = 1 UNION
|
||||
SELECT
|
||||
|
|
@ -346,11 +355,11 @@
|
|||
0 AS stockCount,
|
||||
0 AS inUseCount,
|
||||
0 AS repairCount,
|
||||
0 AS scrappedCount
|
||||
0 AS scrappedCount
|
||||
FROM
|
||||
mm_type mt
|
||||
mm_type mt
|
||||
WHERE
|
||||
mt.`LEVEL` = 4
|
||||
mt.`LEVEL` = 4
|
||||
AND mt.IS_ACTIVE = 1 UNION
|
||||
SELECT
|
||||
0 AS projectCount,
|
||||
|
|
@ -367,7 +376,7 @@
|
|||
0 AS stockCount,
|
||||
0 AS inUseCount,
|
||||
0 AS repairCount,
|
||||
0 AS scrappedCount
|
||||
0 AS scrappedCount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
|
@ -379,14 +388,14 @@
|
|||
0 scrapNum,
|
||||
0 loseNum,
|
||||
0 waitInputNum,
|
||||
1 AS isCount
|
||||
1 AS isCount
|
||||
FROM
|
||||
mm_type mat1
|
||||
LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
WHERE
|
||||
mat1.`LEVEL` = 4
|
||||
AND mat1.IS_ACTIVE = '1'
|
||||
mat1.`LEVEL` = 4
|
||||
AND mat1.IS_ACTIVE = '1'
|
||||
GROUP BY
|
||||
mat1.ID UNION
|
||||
SELECT
|
||||
|
|
@ -398,7 +407,7 @@
|
|||
0 scrapNum,
|
||||
0 loseNum,
|
||||
0 waitInputNum,
|
||||
1 AS isCount
|
||||
1 AS isCount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
|
@ -410,7 +419,7 @@
|
|||
mt.UNIT,
|
||||
SUM( wir.NUM ) AS leaseNum,
|
||||
0 AS backNum,
|
||||
mt.IS_COUNT AS isCount
|
||||
mt.IS_COUNT AS isCount
|
||||
FROM
|
||||
wf_info_record wir
|
||||
LEFT JOIN wf_task_record wtr ON wir.SUP_ID = wtr.ID
|
||||
|
|
@ -418,12 +427,12 @@
|
|||
LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID
|
||||
LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID
|
||||
LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID
|
||||
LEFT JOIN wf_collar_details wcd ON wcd.TASK_ID = wtr.SUP_ID
|
||||
AND wcd.MODEL_ID = wir.MODEL_ID
|
||||
LEFT JOIN wf_collar_details wcd ON wcd.TASK_ID = wtr.SUP_ID
|
||||
AND wcd.MODEL_ID = wir.MODEL_ID
|
||||
WHERE
|
||||
wir.TYPE = 2
|
||||
AND wtr2.IS_ACTIVE = 1
|
||||
AND wcd.IS_APPROVAL = 1
|
||||
wir.TYPE = 2
|
||||
AND wtr2.IS_ACTIVE = 1
|
||||
AND wcd.IS_APPROVAL = 1
|
||||
GROUP BY
|
||||
mt.ID UNION
|
||||
SELECT
|
||||
|
|
@ -435,20 +444,20 @@
|
|||
mt.UNIT,
|
||||
0 AS leaseNum,
|
||||
SUM( wir.NUM ) AS backNum,
|
||||
mt.IS_COUNT AS isCount
|
||||
mt.IS_COUNT AS isCount
|
||||
FROM
|
||||
wf_info_record wir
|
||||
LEFT JOIN wf_return_material_details wrd ON wir.SUP_ID = wrd.ID
|
||||
LEFT JOIN wf_task_record wtr ON wrd.TASK_ID = wtr.ID
|
||||
LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID
|
||||
LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID
|
||||
LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID
|
||||
LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID
|
||||
WHERE
|
||||
wir.TYPE = 4
|
||||
AND wtr.IS_ACTIVE = 1
|
||||
wir.TYPE = 4
|
||||
AND wtr.IS_ACTIVE = 1
|
||||
GROUP BY
|
||||
mt.ID
|
||||
) a
|
||||
mt.ID
|
||||
) a
|
||||
GROUP BY
|
||||
typeId UNION
|
||||
SELECT
|
||||
|
|
@ -460,12 +469,12 @@
|
|||
0 scrapNum,
|
||||
0 loseNum,
|
||||
0 waitInputNum,
|
||||
1 AS isCount
|
||||
1 AS isCount
|
||||
FROM
|
||||
wf_repair_details wrd
|
||||
LEFT JOIN mm_type mat1 ON wrd.MODEL_ID = mat1.ID
|
||||
LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
GROUP BY
|
||||
wrd.MODEL_ID UNION
|
||||
SELECT
|
||||
|
|
@ -477,12 +486,12 @@
|
|||
0 scrapNum,
|
||||
0 loseNum,
|
||||
0 waitInputNum,
|
||||
1 AS isCount
|
||||
1 AS isCount
|
||||
FROM
|
||||
wf_repair_check wrc
|
||||
LEFT JOIN mm_type mat1 ON wrc.MODEL_ID = mat1.ID
|
||||
LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
GROUP BY
|
||||
wrc.MODEL_ID UNION
|
||||
SELECT DISTINCT
|
||||
|
|
@ -496,16 +505,16 @@
|
|||
SUM(
|
||||
IFNULL( PRE_PUT_NUM, 0 )) - sum(
|
||||
IFNULL( AL_PUT_NUM, 0 )) AS waitInputNum,
|
||||
1 AS isCount
|
||||
1 AS isCount
|
||||
FROM
|
||||
wf_put_storage_details wpd
|
||||
LEFT JOIN mm_type mat1 ON wpd.MODEL_ID = mat1.ID
|
||||
LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
WHERE
|
||||
wpd.IS_SURE = 0
|
||||
wpd.IS_SURE = 0
|
||||
GROUP BY
|
||||
wpd.MODEL_ID
|
||||
wpd.MODEL_ID
|
||||
) res UNION
|
||||
SELECT
|
||||
0 AS projectCount,
|
||||
|
|
@ -514,11 +523,11 @@
|
|||
SUM( mat1.NUM ) AS stockCount,
|
||||
0 AS inUseCount,
|
||||
0 AS repairCount,
|
||||
0 AS scrappedCount
|
||||
0 AS scrappedCount
|
||||
FROM
|
||||
mm_type mat1
|
||||
mm_type mat1
|
||||
WHERE
|
||||
mat1.`LEVEL` = 4
|
||||
mat1.`LEVEL` = 4
|
||||
AND mat1.IS_ACTIVE = '1' UNION
|
||||
SELECT
|
||||
0 AS projectCount,
|
||||
|
|
@ -527,7 +536,7 @@
|
|||
0 AS stockCount,
|
||||
sum( leaseNum ) - SUM( backNum ) inUseCount,
|
||||
0 AS repairCount,
|
||||
0 AS scrappedCount
|
||||
0 AS scrappedCount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
|
@ -539,7 +548,7 @@
|
|||
mt.UNIT,
|
||||
SUM( wir.NUM ) AS leaseNum,
|
||||
0 AS backNum,
|
||||
mt.IS_COUNT AS isCount
|
||||
mt.IS_COUNT AS isCount
|
||||
FROM
|
||||
wf_info_record wir
|
||||
LEFT JOIN wf_task_record wtr ON wir.SUP_ID = wtr.ID
|
||||
|
|
@ -547,12 +556,12 @@
|
|||
LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID
|
||||
LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID
|
||||
LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID
|
||||
LEFT JOIN wf_collar_details wcd ON wcd.TASK_ID = wtr.SUP_ID
|
||||
AND wcd.MODEL_ID = wir.MODEL_ID
|
||||
LEFT JOIN wf_collar_details wcd ON wcd.TASK_ID = wtr.SUP_ID
|
||||
AND wcd.MODEL_ID = wir.MODEL_ID
|
||||
WHERE
|
||||
wir.TYPE = 2
|
||||
AND wtr2.IS_ACTIVE = 1
|
||||
AND wcd.IS_APPROVAL = 1
|
||||
wir.TYPE = 2
|
||||
AND wtr2.IS_ACTIVE = 1
|
||||
AND wcd.IS_APPROVAL = 1
|
||||
GROUP BY
|
||||
mt.ID UNION
|
||||
SELECT
|
||||
|
|
@ -564,19 +573,19 @@
|
|||
mt.UNIT,
|
||||
0 AS leaseNum,
|
||||
SUM( wir.NUM ) AS backNum,
|
||||
mt.IS_COUNT AS isCount
|
||||
mt.IS_COUNT AS isCount
|
||||
FROM
|
||||
wf_info_record wir
|
||||
LEFT JOIN wf_return_material_details wrd ON wir.SUP_ID = wrd.ID
|
||||
LEFT JOIN wf_task_record wtr ON wrd.TASK_ID = wtr.ID
|
||||
LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID
|
||||
LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID
|
||||
LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID
|
||||
LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID
|
||||
WHERE
|
||||
wir.TYPE = 4
|
||||
AND wtr.IS_ACTIVE = 1
|
||||
wir.TYPE = 4
|
||||
AND wtr.IS_ACTIVE = 1
|
||||
GROUP BY
|
||||
mt.ID
|
||||
mt.ID
|
||||
) a UNION
|
||||
SELECT
|
||||
0 AS projectCount,
|
||||
|
|
@ -585,7 +594,7 @@
|
|||
0 AS stockCount,
|
||||
0 inUseCount,
|
||||
SUM( repairNum )+ SUM( checkNum )+ SUM( waitInputNum ) AS repairCount,
|
||||
0 AS scrappedCount
|
||||
0 AS scrappedCount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
|
@ -597,12 +606,12 @@
|
|||
0 scrapNum,
|
||||
0 loseNum,
|
||||
0 waitInputNum,
|
||||
1 AS isCount
|
||||
1 AS isCount
|
||||
FROM
|
||||
wf_repair_details wrd
|
||||
LEFT JOIN mm_type mat1 ON wrd.MODEL_ID = mat1.ID
|
||||
LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
GROUP BY
|
||||
wrd.MODEL_ID UNION
|
||||
SELECT
|
||||
|
|
@ -614,12 +623,12 @@
|
|||
0 scrapNum,
|
||||
0 loseNum,
|
||||
0 waitInputNum,
|
||||
1 AS isCount
|
||||
1 AS isCount
|
||||
FROM
|
||||
wf_repair_check wrc
|
||||
LEFT JOIN mm_type mat1 ON wrc.MODEL_ID = mat1.ID
|
||||
LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
GROUP BY
|
||||
wrc.MODEL_ID UNION
|
||||
SELECT DISTINCT
|
||||
|
|
@ -633,16 +642,16 @@
|
|||
SUM(
|
||||
IFNULL( PRE_PUT_NUM, 0 )) - sum(
|
||||
IFNULL( AL_PUT_NUM, 0 )) AS waitInputNum,
|
||||
1 AS isCount
|
||||
1 AS isCount
|
||||
FROM
|
||||
wf_put_storage_details wpd
|
||||
LEFT JOIN mm_type mat1 ON wpd.MODEL_ID = mat1.ID
|
||||
LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
WHERE
|
||||
wpd.IS_SURE = 0
|
||||
wpd.IS_SURE = 0
|
||||
GROUP BY
|
||||
wpd.MODEL_ID
|
||||
wpd.MODEL_ID
|
||||
) res UNION
|
||||
SELECT
|
||||
0 AS projectCount,
|
||||
|
|
@ -651,26 +660,26 @@
|
|||
0 AS stockCount,
|
||||
0 inUseCount,
|
||||
0 AS repairCount,
|
||||
SUM( wsd.ALSCRAP_NUM ) AS scrappedCount
|
||||
SUM( wsd.ALSCRAP_NUM ) AS scrappedCount
|
||||
FROM
|
||||
wf_scrap_details wsd
|
||||
LEFT JOIN mm_type mat1 ON wsd.MODEL_ID = mat1.ID
|
||||
LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
WHERE
|
||||
wsd.IS_SURE = 1
|
||||
) rs
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertPartOne" parameterType="com.bonus.index.beans.PartOneBean">
|
||||
) rs
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertPartOne" parameterType="com.bonus.index.beans.PartOneBean">
|
||||
insert into index_part_one(projectNum,maTypeNum,maTotalNum,maStorageNum,maUseNum,maRepairNum,maScrapNum,time) values
|
||||
(#{projectCount},#{equipmentTypes},#{totalCount},#{stockCount},#{inUseCount},#{repairCount},#{scrappedCount},#{time})
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
<select id="getInputview" parameterType="com.bonus.index.beans.IndexHomeBean" resultMap="two">
|
||||
SELECT
|
||||
SUM(newInputNum) as newInputNum,
|
||||
|
|
@ -689,11 +698,11 @@
|
|||
0 bdInputNum,
|
||||
0 backInputNum
|
||||
FROM
|
||||
wf_info_record wir
|
||||
wf_info_record wir
|
||||
where wir.TYPE = 5
|
||||
union
|
||||
SELECT
|
||||
|
||||
|
||||
0 AS newInputNum,
|
||||
SUM(wir.NUM) repairInputNum,
|
||||
0 bdInputNum,
|
||||
|
|
@ -710,12 +719,12 @@
|
|||
FROM
|
||||
wf_inventory_record wr
|
||||
WHERE wr.INVENTORY_TYPE = "盘盈"
|
||||
) rs
|
||||
|
||||
) rs
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getTypeview" parameterType="com.bonus.index.beans.IndexHomeBean" resultMap="two">
|
||||
|
||||
|
||||
SELECT
|
||||
SUM(if(rs.iscount =0,rs.totalCount, 0)) as bmInputNum,
|
||||
SUM(if(rs.iscount =1,rs.totalCount, 0)) as slInputNum,
|
||||
|
|
@ -733,7 +742,7 @@
|
|||
sum( leaseNum ))+ ROUND(
|
||||
SUM( repairNum )) + ROUND(
|
||||
SUM( checkNum )) + ROUND( SUM( waitInputNum ) ) AS totalCount,
|
||||
iscount
|
||||
iscount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
|
@ -745,14 +754,14 @@
|
|||
0 scrapNum,
|
||||
0 loseNum,
|
||||
0 waitInputNum,
|
||||
mat1.IS_COUNT AS isCount
|
||||
mat1.IS_COUNT AS isCount
|
||||
FROM
|
||||
mm_type mat1
|
||||
LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
|
||||
WHERE
|
||||
mat1.`LEVEL` = 4
|
||||
AND mat1.IS_ACTIVE = '1'
|
||||
mat1.`LEVEL` = 4
|
||||
AND mat1.IS_ACTIVE = '1'
|
||||
GROUP BY
|
||||
mat1.ID UNION
|
||||
SELECT
|
||||
|
|
@ -764,7 +773,7 @@
|
|||
0 scrapNum,
|
||||
0 loseNum,
|
||||
0 waitInputNum,
|
||||
isCount AS isCount
|
||||
isCount AS isCount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
|
@ -776,7 +785,7 @@
|
|||
mt.UNIT,
|
||||
SUM( wir.NUM ) AS leaseNum,
|
||||
0 AS backNum,
|
||||
mt.IS_COUNT AS isCount
|
||||
mt.IS_COUNT AS isCount
|
||||
FROM
|
||||
wf_info_record wir
|
||||
LEFT JOIN wf_task_record wtr ON wir.SUP_ID = wtr.ID
|
||||
|
|
@ -784,12 +793,12 @@
|
|||
LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID
|
||||
LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID
|
||||
LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID
|
||||
LEFT JOIN wf_collar_details wcd ON wcd.TASK_ID = wtr.SUP_ID
|
||||
AND wcd.MODEL_ID = wir.MODEL_ID
|
||||
LEFT JOIN wf_collar_details wcd ON wcd.TASK_ID = wtr.SUP_ID
|
||||
AND wcd.MODEL_ID = wir.MODEL_ID
|
||||
WHERE
|
||||
wir.TYPE = 2
|
||||
AND wtr2.IS_ACTIVE = 1
|
||||
AND wcd.IS_APPROVAL = 1
|
||||
wir.TYPE = 2
|
||||
AND wtr2.IS_ACTIVE = 1
|
||||
AND wcd.IS_APPROVAL = 1
|
||||
GROUP BY
|
||||
mt.ID UNION
|
||||
SELECT
|
||||
|
|
@ -801,50 +810,50 @@
|
|||
mt.UNIT,
|
||||
0 AS leaseNum,
|
||||
SUM( wir.NUM ) AS backNum,
|
||||
mt.IS_COUNT AS isCount
|
||||
mt.IS_COUNT AS isCount
|
||||
FROM
|
||||
wf_info_record wir
|
||||
LEFT JOIN wf_return_material_details wrd ON wir.SUP_ID = wrd.ID
|
||||
LEFT JOIN wf_task_record wtr ON wrd.TASK_ID = wtr.ID
|
||||
LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID
|
||||
LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID
|
||||
LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID
|
||||
LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID
|
||||
WHERE
|
||||
wir.TYPE = 4
|
||||
AND wtr.IS_ACTIVE = 1
|
||||
wir.TYPE = 4
|
||||
AND wtr.IS_ACTIVE = 1
|
||||
GROUP BY
|
||||
mt.ID
|
||||
) a
|
||||
mt.ID
|
||||
) a
|
||||
GROUP BY
|
||||
typeId
|
||||
|
||||
) res
|
||||
GROUP BY isCount
|
||||
) rs
|
||||
|
||||
|
||||
) res
|
||||
GROUP BY isCount
|
||||
) rs
|
||||
|
||||
</select>
|
||||
|
||||
<insert id="insertPartTwo" parameterType="com.bonus.index.beans.PartTwoBean">
|
||||
|
||||
<insert id="insertPartTwo" parameterType="com.bonus.index.beans.PartTwoBean">
|
||||
insert into index_part_two(newInputNum,repairInputNum,bdInputNum,backInputNum,total,slInputNum,bmInputNum,totalNum,time) values
|
||||
(#{newStorage.value},#{repairStorage.value},#{inventoryStorage.value},#{returnStorage.value},#{newStorage.total},#{equipmentCount.value},#{deviceCount.value},#{equipmentCount.total},#{time})
|
||||
</insert>
|
||||
|
||||
</insert>
|
||||
|
||||
<select id="getHomeResource" parameterType="com.bonus.index.beans.IndexHomeResourseBean" resultType="com.bonus.index.beans.IndexHomeResourseBean">
|
||||
|
||||
|
||||
SELECT
|
||||
|
||||
|
||||
pr.ID,
|
||||
pr.`NAME` as rsName,
|
||||
pr.ICON as rsIcon,
|
||||
pr.URL as rsUrl
|
||||
pr.URL as rsUrl
|
||||
FROM
|
||||
pm_user_resourse pur
|
||||
LEFT JOIN pm_resources pr on pur.resourse_id = pr.ID
|
||||
WHERE pur.user_id =#{userId}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getResource" parameterType="com.bonus.index.beans.IndexHomeResourseBean" resultType="com.bonus.index.beans.IndexHomeResourseBean">
|
||||
SELECT
|
||||
pr.ID,
|
||||
|
|
@ -865,22 +874,22 @@
|
|||
) b ON pr.ID = b.RES_ID
|
||||
WHERE pr.PARENT_ID != 0
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<delete id="deleteResourse" parameterType="com.bonus.index.beans.IndexHomeResourseBean">
|
||||
DELETE FROM pm_user_resourse
|
||||
|
||||
|
||||
where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
<insert id="insertResourse" parameterType="com.bonus.index.beans.IndexHomeResourseBean">
|
||||
insert into pm_user_resourse
|
||||
(user_id,resourse_id)
|
||||
values
|
||||
(#{userId},#{rsId})
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- 查询工程领料、退料、维修检验、机具报废、修试后入库、新购入库、库存盘点数量 -->
|
||||
<select id="getProAndNum" resultType="com.bonus.index.beans.IndexDetailVo">
|
||||
SELECT A.proId,
|
||||
|
|
@ -892,21 +901,21 @@
|
|||
FROM wf_info_record wir
|
||||
LEFT JOIN wf_task_record wtr on wir.SUP_ID = wtr.ID
|
||||
LEFT JOIN wf_task_record wtr2 on wtr.SUP_ID = wtr2.ID
|
||||
LEFT JOIN wf_ma_outstock wot on wir.SUP_ID = wot.TASK_ID
|
||||
LEFT JOIN wf_ma_outstock wot on wir.SUP_ID = wot.TASK_ID
|
||||
LEFT JOIN wf_agreement_task wat on wtr2.ID = wat.TASK_ID
|
||||
LEFT JOIN wf_lease_agreement wla on wat.AGREEMENT_ID = wla.ID
|
||||
LEFT JOIN bm_project bp on wla.PROJECT = bp.ID
|
||||
WHERE wir.TYPE = 2 and wot.IS_APPROVAL = 1 AND LEFT(wir.TIME,10) = #{time}
|
||||
UNION ALL
|
||||
SELECT bp.ID AS proId,bp.`NAME` AS proName,wir.type,wir.num
|
||||
SELECT bp.ID AS proId,bp.`NAME` AS proName,wir.type,wir.num
|
||||
FROM wf_info_record wir
|
||||
LEFT JOIN wf_return_material_details wrd on wir.SUP_ID = wrd.ID
|
||||
LEFT JOIN wf_return_material_details wrd on wir.SUP_ID = wrd.ID
|
||||
LEFT JOIN wf_task_record wtr on wrd.TASK_ID = wtr.ID
|
||||
LEFT JOIN wf_agreement_task wat on wtr.ID = wat.TASK_ID
|
||||
LEFT JOIN wf_lease_agreement wla on wat.AGREEMENT_ID = wla.ID
|
||||
LEFT JOIN bm_project bp on wla.PROJECT = bp.ID
|
||||
WHERE wir.TYPE = 4 AND LEFT(wir.TIME,10) = #{time}
|
||||
) A
|
||||
) A
|
||||
<where>
|
||||
<if test="proName!=null and proName!=''">
|
||||
AND INSTR(A.proName,#{proName}) > 0
|
||||
|
|
@ -914,5 +923,5 @@
|
|||
</where>
|
||||
GROUP BY A.proId
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue