ezhizao_zx hai 11 meses
pai
achega
024d7fe486

+ 1 - 1
src/main/java/cn/ezhizao/project/business/controller/BizOutsourcedOrderController.java

@@ -860,7 +860,7 @@ public class BizOutsourcedOrderController extends BaseController {
         condition.setDeptCode("170000");
         SysDept dept = deptService.getDeptList(condition).stream().findFirst().orElse(null);
         bizProductionPlanDetail.setDeptId(dept != null ? dept.getValue() : null);
-        List<BizProductionPlanDetail> list = bizProductionPlanDetailService.getList(bizProductionPlanDetail);
+        List<BizProductionPlanDetail> list = bizProductionPlanDetailService.getListForOutsource(bizProductionPlanDetail);
         return getDataTable(list);
     }
 

+ 8 - 0
src/main/java/cn/ezhizao/project/business/mapper/BizProductionPlanDetailMapper.java

@@ -23,6 +23,14 @@ public interface BizProductionPlanDetailMapper extends BaseMapper<BizProductionP
      */
     public List<BizProductionPlanDetail> getList(BizProductionPlanDetail data);
 
+    /**
+     * 查询生产计划明细列表
+     *
+     * @param data 生产计划明细
+     * @return 生产计划明细集合
+     */
+    public List<BizProductionPlanDetail> getListForOutsource(BizProductionPlanDetail data);
+
     public List<BizProductionPlanDetail> reportList(BizProductionPlanDetail data);
 
     /**

+ 8 - 0
src/main/java/cn/ezhizao/project/business/mapper/BizProductionPlanDetailSubDetailMapper.java

@@ -20,6 +20,14 @@ public interface BizProductionPlanDetailSubDetailMapper extends BaseMapper<BizPr
      */
     List<BizProductionPlanDetailSubDetail> getList(BizProductionPlanDetailSubDetail bizProductionPlanDetailSubDetail);
 
+    /**
+     * 查询生产子计划明细列表
+     *
+     * @param bizProductionPlanDetailSubDetail 生产子计划明细
+     * @return 生产子计划明细集合
+     */
+    List<BizProductionPlanDetailSubDetail> getListForOutsource(BizProductionPlanDetailSubDetail bizProductionPlanDetailSubDetail);
+
     /**
      * 物理删除
      *

+ 7 - 0
src/main/java/cn/ezhizao/project/business/service/IBizProductionPlanDetailService.java

@@ -22,6 +22,13 @@ public interface IBizProductionPlanDetailService extends IService<BizProductionP
      * @return 生产计划明细集合
      */
     List<BizProductionPlanDetail> getList(BizProductionPlanDetail data);
+    /**
+     * 查询生产计划明细列表
+     *
+     * @param data 生产计划明细
+     * @return 生产计划明细集合
+     */
+    List<BizProductionPlanDetail> getListForOutsource(BizProductionPlanDetail data);
 
     /**
      * 查询生产计划明细列表

+ 11 - 1
src/main/java/cn/ezhizao/project/business/service/impl/BizProductionPlanDetailServiceImpl.java

@@ -34,7 +34,17 @@ public class BizProductionPlanDetailServiceImpl  extends ServiceImpl<BizProducti
     {
         return bizProductionPlanDetailMapper.getList(data);
     }
-
+    /**
+     * 查询生产计划明细列表
+     *
+     * @param data 生产计划明细
+     * @return 生产计划明细
+     */
+    @Override
+    public List<BizProductionPlanDetail> getListForOutsource(BizProductionPlanDetail data)
+    {
+        return bizProductionPlanDetailMapper.getListForOutsource(data);
+    }
     /**
      * 查询生产计划明细列表
      *

+ 34 - 4
src/main/resources/mybatis/business/BizProductionPlanDetailMapper.xml

@@ -46,16 +46,18 @@
             t.deleted = 0
             <if test="keywords != null and keywords !=''">AND t.`product_description` LIKE CONCAT('%', #{keywords}, '%')
             </if>
-            <if test="keyword != null and keyword !=''">AND (t.`product_description` LIKE CONCAT('%', #{keyword}, '%') or t.`production_plan_no` LIKE CONCAT('%', #{keyword}, '%'))
+            <if test="keyword != null and keyword !=''">AND (t.`product_description` LIKE CONCAT('%', #{keyword}, '%')
+                or t.`production_plan_no` LIKE CONCAT('%', #{keyword}, '%'))
             </if>
             <if test="productionPlanNo != null and productionPlanNo !=''">AND t.`production_plan_no` LIKE CONCAT('%',
                 #{productionPlanNo}, '%')
             </if>
             <if test="tenantId != null  and tenantId != 0">AND tenant_id = #{tenantId}</if>
-            <if test="deptId != null"> AND exists (select 1 from biz_production_plan_detail_sub_detail t1 where t1.dept_id = #{deptId} and t1.production_plan_detail_id = t.id) </if>
+            <!--            <if test="deptId != null"> AND exists (select 1 from biz_production_plan_detail_sub_detail t1 where t1.dept_id = #{deptId} and t1.production_plan_detail_id = t.id) </if>-->
             <if test="supplierId != null">
                 <!-- 外协商配置的产品 -->
-                AND exists (select 1 from biz_supplier_product sp where sp.deleted = 0 and sp.supplier_id = #{supplierId} and sp.product_id = t.product_id)
+                AND exists (select 1 from biz_supplier_product sp where sp.deleted = 0 and sp.supplier_id =
+                #{supplierId} and sp.product_id = t.product_id)
             </if>
         </trim>
         ORDER BY id DESC
@@ -93,7 +95,9 @@
         GROUP BY
         t.dept_id,
         t1.id
-         order by (select biz_daywork_item.create_time from biz_daywork_item  left join biz_daywork on biz_daywork.id = biz_daywork_item.daywork_id where biz_daywork_item.deleted = 0 and biz_daywork_item.production_plan_detail_id = t1.id order by biz_daywork_item.create_time limit 1 ) DESC
+        order by (select biz_daywork_item.create_time from biz_daywork_item left join biz_daywork on biz_daywork.id =
+        biz_daywork_item.daywork_id where biz_daywork_item.deleted = 0 and biz_daywork_item.production_plan_detail_id =
+        t1.id order by biz_daywork_item.create_time limit 1 ) DESC
     </select>
     <!--    <select id="reportList" resultMap="BizProductionPlanDetailResult">-->
     <!--        SELECT DISTINCT *, (-->
@@ -220,4 +224,30 @@
             <!-- 删除条件为其他外键可以在这里加 -->
         </trim>
     </delete>
+
+
+    <select id="getListForOutsource" resultMap="BizProductionPlanDetailResult">
+        SELECT t.* FROM biz_production_plan_detail t
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            t.deleted = 0
+            <if test="keywords != null and keywords !=''">AND t.`product_description` LIKE CONCAT('%', #{keywords}, '%')
+            </if>
+            <if test="keyword != null and keyword !=''">AND (t.`product_description` LIKE CONCAT('%', #{keyword}, '%')
+                or t.`production_plan_no` LIKE CONCAT('%', #{keyword}, '%'))
+            </if>
+            <if test="productionPlanNo != null and productionPlanNo !=''">AND t.`production_plan_no` LIKE CONCAT('%',
+                #{productionPlanNo}, '%')
+            </if>
+            <if test="tenantId != null  and tenantId != 0">AND tenant_id = #{tenantId}</if>
+            <if test="deptId != null">AND exists (select 1 from biz_production_plan_detail_sub_detail t1 where
+                t1.dept_id = #{deptId} and t1.production_plan_detail_id = t.id)
+            </if>
+            <if test="supplierId != null">
+                <!-- 外协商配置的产品 -->
+                AND exists (select 1 from biz_supplier_product sp where sp.deleted = 0 and sp.supplier_id =
+                #{supplierId} and sp.product_id = t.product_id)
+            </if>
+        </trim>
+        ORDER BY id DESC
+    </select>
 </mapper>

+ 69 - 30
src/main/resources/mybatis/business/BizProductionPlanDetailSubDetailMapper.xml

@@ -1,51 +1,65 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.ezhizao.project.business.mapper.BizProductionPlanDetailSubDetailMapper">
 
-    <resultMap type="cn.ezhizao.project.business.domain.BizProductionPlanDetailSubDetail" id="BizProductionPlanDetailSubDetailResult">
+    <resultMap type="cn.ezhizao.project.business.domain.BizProductionPlanDetailSubDetail"
+               id="BizProductionPlanDetailSubDetailResult">
         <id column="id" property="id"/>
         <result column="technological_process_id" property="technologicalProcessId"/>
         <result column="production_plan_detail_id" property="productionPlanDetailId"/>
         <result column="product_id" property="productId"/>
-        <association property="productDescription" javaType="java.lang.String" column="product_id" select="getProductDescription"/>
-        <association property="drawingNumber" javaType="java.lang.String" column="production_plan_detail_id" select="getDrawingNumber"/>
-        <collection column="id" property="finishProcess" ofType="cn.ezhizao.project.business.domain.BizTechnologicalProcessDetail" select="getFinishProcess"/>
+        <association property="productDescription" javaType="java.lang.String" column="product_id"
+                     select="getProductDescription"/>
+        <association property="drawingNumber" javaType="java.lang.String" column="production_plan_detail_id"
+                     select="getDrawingNumber"/>
+        <collection column="id" property="finishProcess"
+                    ofType="cn.ezhizao.project.business.domain.BizTechnologicalProcessDetail"
+                    select="getFinishProcess"/>
     </resultMap>
 
-    <resultMap  type="cn.ezhizao.project.business.domain.BizTechnologicalProcessDetail" id="BizTechnologicalProcessResult">
+    <resultMap type="cn.ezhizao.project.business.domain.BizTechnologicalProcessDetail"
+               id="BizTechnologicalProcessResult">
         <id column="id" property="id"/>
     </resultMap>
     <select id="getProductDescription" resultType="java.lang.String">
         select description as productDescription from biz_product where deleted = 0 and id = #{product_id}
     </select>
     <select id="getDrawingNumber" resultType="java.lang.String">
-        select drawing_number as drawingNumber from biz_production_plan_detail where deleted = 0 and id = #{production_plan_detail_id}
+        select drawing_number as drawingNumber from biz_production_plan_detail where deleted = 0 and id =
+        #{production_plan_detail_id}
     </select>
     <select id="getFinishProcess" resultMap="BizTechnologicalProcessResult">
         select
-            *
+        *
         from biz_technological_process_detail
         where deleted = 0 and technological_process_id = #{technologicalProcessId}
-          and process_id  in
-            (select process_id from biz_daywork_item where status >5 and deleted = 0 and daywork_id  = (select id from biz_daywork where deleted = 0 and production_plan_detail_sub_detail_id = #{id}))
+        and process_id in
+        (select process_id from biz_daywork_item where status >5 and deleted = 0 and daywork_id = (select id from
+        biz_daywork where deleted = 0 and production_plan_detail_sub_detail_id = #{id}))
         order by process_step_number
     </select>
 
-    <select id="getList" parameterType="BizProductionPlanDetailSubDetail" resultMap="BizProductionPlanDetailSubDetailResult">
-        SELECT t.*, t2.product_description, t2.one_lot_quantity FROM biz_production_plan_detail_sub_detail t left join biz_production_plan_detail t2 on t2.id = t.production_plan_detail_id
+    <select id="getList" parameterType="BizProductionPlanDetailSubDetail"
+            resultMap="BizProductionPlanDetailSubDetailResult">
+        SELECT t.*, t2.product_description, t2.one_lot_quantity FROM biz_production_plan_detail_sub_detail t left join
+        biz_production_plan_detail t2 on t2.id = t.production_plan_detail_id
         <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
             t.deleted = 0
-            <if test="productionPlanDetailId != null"> AND t.production_plan_detail_id = #{productionPlanDetailId}</if>
-            <if test="lotNumber != null "> AND t.lot_number = #{lotNumber}</if>
-            <if test="productionPlanNo != null "> AND t.production_plan_no like concat('%', #{productionPlanNo}, '%') </if>
-            <if test="tenantId != null and tenantId != 0"> AND t.tenant_id = #{tenantId}</if>
-            <if test="keyword != null"> AND (t.production_plan_no like #{keyword} or t2.product_description like #{keyword}) </if>
-            <if test="deptId != null"> AND t.dept_id = #{deptId} </if>
+            <if test="productionPlanDetailId != null">AND t.production_plan_detail_id = #{productionPlanDetailId}</if>
+            <if test="lotNumber != null ">AND t.lot_number = #{lotNumber}</if>
+            <if test="productionPlanNo != null ">AND t.production_plan_no like concat('%', #{productionPlanNo}, '%')
+            </if>
+            <if test="tenantId != null and tenantId != 0">AND t.tenant_id = #{tenantId}</if>
+            <if test="keyword != null">AND (t.production_plan_no like #{keyword} or t2.product_description like
+                #{keyword})
+            </if>
+            <!--            <if test="deptId != null"> AND t.dept_id = #{deptId} </if>-->
             <if test="supplierId != null">
                 <!-- 外协商配置的产品 -->
-                AND exists (select 1 from biz_supplier_product sp where sp.deleted = 0 and sp.supplier_id = #{supplierId} and sp.product_id = t.product_id)
+                AND exists (select 1 from biz_supplier_product sp where sp.deleted = 0 and sp.supplier_id =
+                #{supplierId} and sp.product_id = t.product_id)
             </if>
         </trim>
         ORDER BY create_time DESC
@@ -54,19 +68,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <!-- 根据关键字获取列表 -->
     <select id="getListByKeywords" parameterType="String" resultMap="BizProductionPlanDetailSubDetailResult">
         SELECT
-            t1.*,
-            t2.specification AS product_specification,
-            t2.drawing_number,
-            t2.company_alias,
-            t2.description AS product_description
+        t1.*,
+        t2.specification AS product_specification,
+        t2.drawing_number,
+        t2.company_alias,
+        t2.description AS product_description
         FROM biz_production_plan_detail_sub_detail t1
         INNER JOIN biz_product t2 ON t1.product_id=t2.id
         <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
             t1.deleted = 0
-            <if test="keywords != null and keywords != ''"> AND t2.description LIKE CONCAT('%', #{keywords}, '%')</if>
-            <if test="deptId !=null and deptId !=''"> AND t1.dept_id = #{deptId}</if>
-            <if test="productDescription !=null and productDescription !=''"> AND t2.description LIKE CONCAT('%', #{productDescription}, '%')</if>
-            <if test="tenantId != null  and tenantId != 0"> AND t1.tenant_id = #{tenantId}</if>
+            <if test="keywords != null and keywords != ''">AND t2.description LIKE CONCAT('%', #{keywords}, '%')</if>
+            <if test="deptId !=null and deptId !=''">AND t1.dept_id = #{deptId}</if>
+            <if test="productDescription !=null and productDescription !=''">AND t2.description LIKE CONCAT('%',
+                #{productDescription}, '%')
+            </if>
+            <if test="tenantId != null  and tenantId != 0">AND t1.tenant_id = #{tenantId}</if>
         </trim>
         ORDER BY t1.create_time DESC
     </select>
@@ -77,7 +93,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="id != null">
                 id = #{id} AND
             </if>
-       <!-- 删除条件为其他外键可以在这里加 -->
+            <!-- 删除条件为其他外键可以在这里加 -->
         </trim>
     </delete>
+    <select id="getListForOutsource" parameterType="BizProductionPlanDetailSubDetail"
+            resultMap="BizProductionPlanDetailSubDetailResult">
+        SELECT t.*, t2.product_description, t2.one_lot_quantity FROM biz_production_plan_detail_sub_detail t left join
+        biz_production_plan_detail t2 on t2.id = t.production_plan_detail_id
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            t.deleted = 0
+            <if test="productionPlanDetailId != null">AND t.production_plan_detail_id = #{productionPlanDetailId}</if>
+            <if test="lotNumber != null ">AND t.lot_number = #{lotNumber}</if>
+            <if test="productionPlanNo != null ">AND t.production_plan_no like concat('%', #{productionPlanNo}, '%')
+            </if>
+            <if test="tenantId != null and tenantId != 0">AND t.tenant_id = #{tenantId}</if>
+            <if test="keyword != null">AND (t.production_plan_no like #{keyword} or t2.product_description like
+                #{keyword})
+            </if>
+            <if test="deptId != null">AND t.dept_id = #{deptId}</if>
+            <if test="supplierId != null">
+                <!-- 外协商配置的产品 -->
+                AND exists (select 1 from biz_supplier_product sp where sp.deleted = 0 and sp.supplier_id =
+                #{supplierId} and sp.product_id = t.product_id)
+            </if>
+        </trim>
+        ORDER BY create_time DESC
+    </select>
 </mapper>