From 7efc6ed86025b610cab109a2e9f83362740d8ed4 Mon Sep 17 00:00:00 2001
From: 李旭东 <woaiguo66@sina.com>
Date: 星期五, 08 十二月 2023 13:29:07 +0800
Subject: [PATCH] Merge branch 'master' of http://111.30.93.211:10101/r/supipe

---
 hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml |  239 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 214 insertions(+), 25 deletions(-)

diff --git a/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml b/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml
index 46ff19f..93127b1 100644
--- a/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml
+++ b/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml
@@ -196,7 +196,10 @@
                      tpi.segment_id = #{segmentId} AND
                  </if>
                  <if test="yearMonth!=null">
-                     out_mod_time like CONCAT(#{yearMonth},'%') AND
+                     tpi.out_mod_time like CONCAT(#{yearMonth},'%') AND
+                 </if>
+                 <if test="goIn!=null">
+                     tpi.go_in = 2 AND
                  </if>
              </trim>
          </where>
@@ -243,32 +246,39 @@
     </select>
 
     <select id="queryPipeInfoByPipeId" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.PipeInfoVo">
-        select tsp.produce_number as produceNumber,sp.pro_name as proName,su1.real_name as createUserName,su2.real_name as steelCheckUserName,tsp.quality_time as steelCheckTime,tsp.is_qualified as steelCheckResult,tsp.print_time as printTime,
-
-               sm.mould_num as mouldNum,sm.current_cycle_time as currentCycleTime,sm.max_cycle_time as maxCycleTime,sm.mould_code as mouldCode,
-
-               tpi.ring_num as ringNum,tpi.pipe_num as pipeNum,tpi.into_mod_time as intoModTime,
-               tpi.check_user as checkUser,su.real_name as pipeCheckUserName,tpi.check_time as pipeCheckTime,
-               sd1.dict_name as turnName,
-               sd2.dict_name as reinforcementName,
-               sd3.dict_name as groutingHolesName,
-               sd4.dict_name as blockNumName,
-               sd5.dict_name as sizeName,
-               sd6.dict_name as mouldTypeName
+        select
+            tsp.produce_number as produceNumber,
+            sp.pro_name as proName,
+            spu.real_name as createUserName,
+            su2.real_name as steelCheckUserName,
+            tsp.quality_time as steelCheckTime,
+            tsp.is_qualified as steelCheckResult,
+            tsp.print_time as printTime,
+            sm.mould_num as mouldNum,sm.current_cycle_time as currentCycleTime,sm.max_cycle_time as maxCycleTime,sm.mould_code as mouldCode,
+            tpi.ring_num as ringNum,tpi.pipe_num as pipeNum,tpi.into_mod_time as intoModTime,
+            tpi.check_user as checkUser,su.real_name as pipeCheckUserName,tpi.check_time as pipeCheckTime,
+            sd1.dict_name as turnName,
+            sd2.dict_name as reinforcementName,
+            sd3.dict_name as groutingHolesName,
+            sd4.dict_name as blockNumName,
+            sd5.dict_name as sizeName,
+            sd6.dict_name as mouldTypeName
 
         from t_pipe_info tpi
-                 left join sys_dict sd1 on sd1.dict_id = tpi.turn
-                 left join sys_dict sd2 on sd2.dict_id = tpi.reinforcement
-                 left join sys_dict sd3 on sd3.dict_id = tpi.grouting_holes
-                 left join sys_dict sd4 on sd4.dict_id = tpi.block_num
-                 left join sys_dict sd5 on sd5.dict_id = tpi.size
-                 left join sys_mould sm on sm.mould_id = tpi.mod_id
-                 left join sys_dict sd6 on sd6.dict_id = sm.mould_type
-                 left join t_steel_produce tsp on tsp.produce_number = tpi.produce_number
-                 left join sys_project sp on sp.pro_id = tpi.pro_id
-                 left join sys_users su on su.user_id = tpi.check_user
-                 left join sys_users su1 on su1.user_id = tsp.create_user
-                 left join sys_users su2 on su2.user_id = tsp.quality_user
+        left join sys_dict sd1 on sd1.dict_id = tpi.turn
+        left join sys_dict sd2 on sd2.dict_id = tpi.reinforcement
+        left join sys_dict sd3 on sd3.dict_id = tpi.grouting_holes
+        left join sys_dict sd4 on sd4.dict_id = tpi.block_num
+        left join sys_dict sd5 on sd5.dict_id = tpi.size
+        left join sys_mould sm on sm.mould_id = tpi.mod_id
+        left join sys_dict sd6 on sd6.dict_id = sm.mould_type
+        left join t_steel_produce tsp on tsp.produce_number = tpi.produce_number
+        left join sys_project sp on sp.pro_id = tpi.pro_id
+        left join sys_users su on su.user_id = tpi.check_user
+        left join sys_users su1 on su1.user_id = tsp.create_user
+        left join sys_users su2 on su2.user_id = tsp.quality_user
+        left join t_steel_print stp on stp.steel_print_id = tsp.steel_print_id
+        left join sys_plat_user spu on spu.user_id = stp.plat_user_id
         where 1=1
         <if test="pipeId != null">
            and tpi.pipe_id = #{pipeId}
@@ -478,6 +488,25 @@
              where create_flag = 1 and pro_id=#{proId}
                and size=#{size} and reinforcement=#{reinforcement} GROUP BY ring_num) a
                       )c where c.isExist = 0 order by c.ringnum limit 1
+    </select>
+
+    <select id="queryRingCompleteByMod" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.RingCompleteCheck">
+        select a.ringnum,a.pipeModNum,a.allModNum
+        from
+            (
+                select tpi.ring_num as ringnum,GROUP_CONCAT(sm.mould_num order by sm.mould_num) as pipeModNum,
+                       (
+                           select GROUP_CONCAT(sm1.mould_num order by sm1.mould_num)
+                           from sys_mould sm1
+                           where SUBSTRING_INDEX(sm1.mould_num,'-',-1) = SUBSTRING_INDEX(#{mouldNum},'-',-1) and sm1.is_use = 1 and sm1.pro_id = #{proId}
+                           group by sm1.is_use
+                       ) as allModNum
+                from t_pipe_info tpi
+                         left join sys_mould sm on sm.mould_id = tpi.mod_id
+                where SUBSTRING_INDEX(sm.mould_num,'-',-1) = SUBSTRING_INDEX(#{mouldNum},'-',-1) and sm.is_use = 1 and tpi.pro_id = #{proId}
+                GROUP BY tpi.ring_num
+            ) a
+        where a.pipeModNum != a.allModNum and a.pipeModNum not LIKE CONCAT('%',#{mouldNum},'%')
     </select>
 
     <select id="queryMaxRingNum" resultType="int">
@@ -817,6 +846,32 @@
         group by m.mould_type
     </select>
 
+    <select id="queryMouldByNumType" resultType="com.thhy.mobile.modules.biz.mouldcheck.entity.Mould">
+        select
+            t.mould_id as mouldId,
+            t.come_factory_time as comeFactoryTime,
+            t.create_time as createTime,
+            t.create_user as createUser,
+            t.current_cycle_time as currentCycleTime,
+            t.is_use as isUse,
+            t.max_cycle_time as maxCycleTime,
+            t.mould_code as mouldCode,
+            t.mould_num as mouldNum,
+            t.mould_size as mouldSize,
+            t.mould_turn as mouldTurn,
+            t.mould_type as mouldType,
+            t.pro_id as proId,
+            t.product_date as productDate,
+            t.status as status,
+            t.supplier_id as supplierId,
+            t.update_time as updateTime,
+            t.update_user as updateUser,
+            t.grouting_holes as groutingHoles,
+            t.free
+        from sys_mould t
+        where t.pro_id = #{proId} and SUBSTRING_INDEX(t.mould_num,'-',-1) = #{numType}
+    </select>
+
     <select id="queryMaxNumBySteelProduce" resultType="int">
         select
             max(a.number)
@@ -830,4 +885,138 @@
     <select id="countByRingNum" resultType="int">
         select count(pipe_id) from t_pipe_info where ring_num = #{ringNum}
     </select>
+
+    <select id="compelteByRingNumAndPro" resultType="boolean">
+        select (a.pipeBlock=b.proBlock) as result from
+            (
+                select GROUP_CONCAT(block_num order by sd.dict_value) as pipeBlock,tpi.pro_id
+                from t_pipe_info tpi
+                         left join sys_dict sd on sd.dict_id = tpi.block_num
+                where tpi.ring_num = #{ringNum} and tpi.pro_id = #{proId} and tpi.check_result = 1
+                group by tpi.ring_num,tpi.pro_id
+            ) a
+                left join
+            (
+                select GROUP_CONCAT(block_num order by sd1.dict_value) as proBlock,spb.pro_id
+                from sys_pro_blok spb
+                         left join sys_dict sd1 on sd1.dict_id = spb.block_num
+                where spb.pro_id = #{proId}
+                group by spb.pro_id
+            ) b on a.pro_id = b.pro_id
+    </select>
+
+    <select id="queryByRingNumAndPro" resultType="com.thhy.mobile.modules.biz.cultivated.entity.PipeIntoListVo">
+        select t.ring_num as ringNum,t.pipe_num as pipeNum,t.check_time as checkTime,sd.dict_name as blockNum,sp.pro_name as proName
+        from t_pipe_info t
+                 left join sys_dict sd on sd.dict_id = t.block_num
+                 left join sys_project sp on sp.pro_id = t.pro_id
+        where t.ring_num = #{ringNum} and t.pro_id = #{proId}
+        order by t.pipe_num
+    </select>
+
+    <select id="queryWaterTimeByPipeNum" resultType="com.thhy.mobile.modules.biz.cultivated.entity.PipeCultivated">
+        select pc.id,pc.ring_num as ringNum,pc.create_time as createTime,pc.out_time as outTime,pc.out_water as outWater
+        from t_pipe_cultivated_pi pcp
+                 left join t_pipe_cultivated pc on pcp.cultivated_id = pc.id
+        where pipe_num = #{pipeNum}
+    </select>
+
+    <select id="queryRepoDate" resultType="com.thhy.mobile.modules.biz.repo.entity.RepoRecord">
+        select rr.create_time as createTime,rr.record_id as recordId,rrp.out_repo as outRepo,rrp.out_repo_time as outRepoTime
+        from t_repo_record_pipe rrp
+                 left join t_repo_record rr on rrp.record_id = rr.record_id
+        where rrp.pipe_num = #{pipeNum}
+    </select>
+
+    <update id="updatePipeDateByNum">
+        update t_pipe_info
+        <set>
+            <if test="checkTime != null">
+                check_time=#{checkTime},
+            </if>
+            <if test="inModTime != null">
+                into_mod_time=#{inModTime},
+            </if>
+            <if test="outModTime != null">
+                out_mod_time=#{outModTime},
+            </if>
+            <if test="pouringTime != null">
+                pouring_time=#{pouringTime},
+            </if>
+            <if test="placingInTime != null">
+                placing_in_time=#{placingInTime},
+            </if>
+            <if test="placingOutTime != null">
+                placing_out_time=#{placingOutTime},
+            </if>
+            <if test="inRepoTime != null">
+                in_repo_time = #{inRepoTime},
+            </if>
+        </set>
+        where pipe_num=#{pipeNum}
+    </update>
+
+    <update id="updateInWaterTime">
+        update t_pipe_cultivated set create_time = #{createTime} where id =#{id}
+    </update>
+
+    <update id="updateOutWaterTime">
+        update t_pipe_cultivated set out_time = #{outTime} where id =#{id}
+    </update>
+
+    <update id="updateInRepoTime">
+        update t_repo_record set create_time = #{createTime} where record_id =#{recordId}
+    </update>
+
+
+    <select id="queryAllNumType" resultType="integer">
+        select DISTINCT a.numType from (select SUBSTRING_INDEX(m.mould_num,'-',-1) as numType from sys_mould m) a
+    </select>
+
+    <select id="materialInfo" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.MaterialThingDto">
+    select
+	Piece as piece,
+	MAX(CASE WHEN Material = '河砂' THEN FactAmnt END) AS sand,
+	MAX(CASE WHEN Material = '小石子' THEN FactAmnt END) AS pebbles,
+	MAX(CASE WHEN Material = '水泥3' THEN FactAmnt END) AS cement3,
+	MAX(CASE WHEN Material = '粉煤灰2' THEN FactAmnt END) AS flyAsh2,
+	MAX(CASE WHEN Material = '大石子' THEN FactAmnt END) AS dashizi,
+	MAX(CASE WHEN Material = '水' THEN FactAmnt END) AS water,
+	MAX(CASE WHEN Material = '外剂1' THEN FactAmnt END) AS externalAgent1,
+	MAX(CASE WHEN Material = '粉煤灰1' THEN FactAmnt END) AS flyAsh1,
+	MAX(CASE WHEN Material = '水泥4' THEN FactAmnt END) AS cement4,
+	MAX(CASE WHEN Material = '水泥2' THEN FactAmnt END) AS cement2
+	from
+	t_raw_material where types=1
+	GROUP BY Piece
+	ORDER BY Piece desc limit 0,10
+    </select>
+
+    <select id="materialInfoTwo" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.MaterialThingDto">
+    select
+	Piece as piece,
+	MAX(CASE WHEN Material = '河砂' THEN FactAmnt END) AS sand,
+	MAX(CASE WHEN Material = '小石子' THEN FactAmnt END) AS pebbles,
+	MAX(CASE WHEN Material = '水泥3' THEN FactAmnt END) AS cement3,
+	MAX(CASE WHEN Material = '粉煤灰2' THEN FactAmnt END) AS flyAsh2,
+	MAX(CASE WHEN Material = '大石子' THEN FactAmnt END) AS dashizi,
+	MAX(CASE WHEN Material = '水' THEN FactAmnt END) AS water,
+	MAX(CASE WHEN Material = '外剂1' THEN FactAmnt END) AS externalAgent1,
+	MAX(CASE WHEN Material = '粉煤灰1' THEN FactAmnt END) AS flyAsh1,
+	MAX(CASE WHEN Material = '水泥4' THEN FactAmnt END) AS cement4,
+	MAX(CASE WHEN Material = '水泥2' THEN FactAmnt END) AS cement2
+	from
+	t_raw_material where types=2
+	GROUP BY Piece
+	ORDER BY Piece desc limit 0,10
+    </select>
+    <select id="materialNumInfo" resultType="com.thhy.mobile.modules.biz.pipeinfo.entity.MaterialThingNumDto">
+        SELECT
+	Material as material,
+	CAST( SUM( FactAmnt ) AS FLOAT ) AS counts
+FROM
+	t_raw_material
+GROUP BY
+	Material
+    </select>
 </mapper>

--
Gitblit v1.9.3