|
@@ -21,10 +21,10 @@
|
|
|
select="getLastLotQuantity"/>
|
|
|
<association property="totalWorkingHours" column="{id=id,deptId=dept_id}" select="getTotalWorkingHours"/>
|
|
|
</resultMap>
|
|
|
-
|
|
|
<resultMap type="cn.ezhizao.project.business.domain.BizDaywork" id="BizDayworkResultForOutsource">
|
|
|
<id column="id" property="id"/>
|
|
|
- <collection property="originalCarrierList" ofType="cn.ezhizao.project.business.domain.BizDayworkCarrier" column="id" select="getOriginalCarrierList"/>
|
|
|
+ <collection property="originalCarrierList" ofType="cn.ezhizao.project.business.domain.BizDayworkCarrier"
|
|
|
+ column="id" select="getOriginalCarrierList"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap id="BizDayworkItemResult" type="cn.ezhizao.project.business.domain.BizDayworkItem">
|
|
@@ -35,12 +35,15 @@
|
|
|
<result column="equipment_detail_id" property="equipmentDetailId"/>
|
|
|
<result column="equipment_detail_code" property="equipmentDetailCode"/>
|
|
|
<result column="lot_id" property="lotId"/>
|
|
|
- <result column="production_plan_detail_id" property="productionPlanDetailId" />
|
|
|
+ <result column="production_plan_detail_id" property="productionPlanDetailId"/>
|
|
|
<result column="technological_process_detail_id" property="technologicalProcessDetailId"/>
|
|
|
<association property="lotCode" column="lot_id" javaType="java.lang.String" select="getLotCode"/>
|
|
|
- <association property="processAlias" column="technological_process_detail_id" javaType="java.lang.String" select="getProcessName"/>
|
|
|
- <association property="technologyVersion" column="lot_id" javaType="java.lang.String" select="getTechnologyVersion"/>
|
|
|
- <association property="productDescription" column="production_plan_detail_id" javaType="java.lang.String" select="getProductDescription"/>
|
|
|
+ <association property="processAlias" column="technological_process_detail_id" javaType="java.lang.String"
|
|
|
+ select="getProcessName"/>
|
|
|
+ <association property="technologyVersion" column="lot_id" javaType="java.lang.String"
|
|
|
+ select="getTechnologyVersion"/>
|
|
|
+ <association property="productDescription" column="production_plan_detail_id" javaType="java.lang.String"
|
|
|
+ select="getProductDescription"/>
|
|
|
<association property="rejectNum" column="id" javaType="java.lang.String" select="getRejectNum"></association>
|
|
|
<association property="firstProcessId" column="daywork_id" select="getFirstProcess"/>
|
|
|
</resultMap>
|
|
@@ -66,7 +69,7 @@
|
|
|
<association property="lastLotQuantity" javaType="java.lang.Integer" column="production_plan_detail_id"
|
|
|
select="getLastLotQuantity"/>
|
|
|
<association property="processAlias" column="id" select="getProcessAlias"/>
|
|
|
-<!-- <association property="lotWaste" column="lot_id" select="getLotWaste"/>-->
|
|
|
+ <!-- <association property="lotWaste" column="lot_id" select="getLotWaste"/>-->
|
|
|
<association property="totalWorkingHours" column="{id=id,deptId=dept_id}" select="getTotalWorkingHours"/>
|
|
|
</resultMap>
|
|
|
<select id="getDayworkInfo" resultMap="BizLotResult">
|
|
@@ -80,7 +83,9 @@
|
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
t2.production_plan_no = #{productionPlanNo} AND t2.line_number = #{lineNumber}
|
|
|
<if test="deptId != null AND deptId != 0">AND t3.dept_id = #{deptId}</if>
|
|
|
- <if test="productDescription != null AND productDescription != ''">AND t2.product_description like concat('%',#{productDescription},'%')</if>
|
|
|
+ <if test="productDescription != null AND productDescription != ''">AND t2.product_description like
|
|
|
+ concat('%',#{productDescription},'%')
|
|
|
+ </if>
|
|
|
<if test="lotCode != null AND lotCode != ''">AND t1.lot_code like concat('%',#{lotCode},'%')</if>
|
|
|
<if test="isWasteRecycling != null ">AND t1.is_waste_recycling = #{isWasteRecycling}</if>
|
|
|
<if test="isFallback != null ">AND t1.is_fallback = #{isFallback}</if>
|
|
@@ -88,28 +93,28 @@
|
|
|
</select>
|
|
|
<select id="getProducedLot" resultMap="BizLotResult">
|
|
|
SELECT DISTINCT
|
|
|
- t2.id AS lot_id,
|
|
|
- t2.lot_code,
|
|
|
- t2.technology_version,
|
|
|
- t2.production_quantity,
|
|
|
- t2.from_id,
|
|
|
- (select lot_code from biz_lot where t2.from_id =biz_lot.id ) as from_code,
|
|
|
- t2.is_waste_recycling,
|
|
|
- t2.is_amend,
|
|
|
- t2.is_fallback,
|
|
|
- t2.is_waste,
|
|
|
- t3.company_alias,
|
|
|
- t3.production_plan_no,
|
|
|
- t3.product_description AS description,
|
|
|
- t1.id,
|
|
|
- t1.create_time,
|
|
|
- t1.temporary_process_qualified_num,
|
|
|
- t4.dept_name,
|
|
|
- t4.dept_id
|
|
|
+ t2.id AS lot_id,
|
|
|
+ t2.lot_code,
|
|
|
+ t2.technology_version,
|
|
|
+ t2.production_quantity,
|
|
|
+ t2.from_id,
|
|
|
+ (select lot_code from biz_lot where t2.from_id =biz_lot.id ) as from_code,
|
|
|
+ t2.is_waste_recycling,
|
|
|
+ t2.is_amend,
|
|
|
+ t2.is_fallback,
|
|
|
+ t2.is_waste,
|
|
|
+ t3.company_alias,
|
|
|
+ t3.production_plan_no,
|
|
|
+ t3.product_description AS description,
|
|
|
+ t1.id,
|
|
|
+ t1.create_time,
|
|
|
+ t1.temporary_process_qualified_num,
|
|
|
+ t4.dept_name,
|
|
|
+ t4.dept_id
|
|
|
FROM biz_daywork t1
|
|
|
- LEFT JOIN biz_lot t2 on t2.id = t1.lot_id
|
|
|
- INNER JOIN biz_production_plan_detail t3 on t2.production_plan_detail_id = t3.id
|
|
|
- LEFT JOIN sys_dept t4 on t1.dept_id = t4.dept_id
|
|
|
+ LEFT JOIN biz_lot t2 on t2.id = t1.lot_id
|
|
|
+ INNER JOIN biz_production_plan_detail t3 on t2.production_plan_detail_id = t3.id
|
|
|
+ LEFT JOIN sys_dept t4 on t1.dept_id = t4.dept_id
|
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
t3.production_plan_no = #{productionPlanNo} AND t3.line_number = #{lineNumber}
|
|
|
<if test="deptId != null ">AND t1.dept_id = #{deptId}</if>
|
|
@@ -117,59 +122,73 @@
|
|
|
AND t3.product_description like concat('%',#{productDescription},'%')
|
|
|
</if>
|
|
|
<if test="lotCode != null and lotCode != ''">AND t2.lot_code like concat('%',#{lotCode},'%')</if>
|
|
|
- <if test="technologyVersion != null and technologyVersion != ''">AND t2.technology_version = #{technologyVersion}</if>
|
|
|
+ <if test="technologyVersion != null and technologyVersion != ''">AND t2.technology_version =
|
|
|
+ #{technologyVersion}
|
|
|
+ </if>
|
|
|
<if test="processId != null">AND (select process_id from biz_daywork_item where lot_id = t2.id order by
|
|
|
create_time desc limit 1) = #{processId}
|
|
|
</if>
|
|
|
<if test="flags != null and flags.size() > 0">
|
|
|
AND
|
|
|
<foreach collection="flags" item="flag" separator=" OR " open="(" close=")">
|
|
|
- <if test="flag != null and flag == 2"> t2.is_amend= 1</if>
|
|
|
- <if test="flag != null and flag == 1"> t2.is_waste_recycling= 1</if>
|
|
|
- <if test="flag != null and flag == 0"> t2.is_waste= 1</if>
|
|
|
- <if test="flag != null and flag == 3"> t2.is_waste= 0 and t2.is_waste_recycling= 0 and t2.is_amend = 0 </if>
|
|
|
+ <if test="flag != null and flag == 2">t2.is_amend= 1</if>
|
|
|
+ <if test="flag != null and flag == 1">t2.is_waste_recycling= 1</if>
|
|
|
+ <if test="flag != null and flag == 0">t2.is_waste= 1</if>
|
|
|
+ <if test="flag != null and flag == 3">t2.is_waste= 0 and t2.is_waste_recycling= 0 and t2.is_amend =
|
|
|
+ 0
|
|
|
+ </if>
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</trim>
|
|
|
</select>
|
|
|
-<!-- <select id="getLotWaste" resultType="cn.ezhizao.project.business.domain.BizLotWaste">
|
|
|
- select * FROM biz_lot_waste t1 where t1.lot_id = #{lotId} AND t1.deleted = 0
|
|
|
- </select>-->
|
|
|
+ <!-- <select id="getLotWaste" resultType="cn.ezhizao.project.business.domain.BizLotWaste">
|
|
|
+ select * FROM biz_lot_waste t1 where t1.lot_id = #{lotId} AND t1.deleted = 0
|
|
|
+ </select>-->
|
|
|
<select id="getFirstProcess" resultType="long">
|
|
|
- SELECT
|
|
|
- process_id AS firstProcessId
|
|
|
+ SELECT process_id AS firstProcessId
|
|
|
FROM biz_daywork_item
|
|
|
WHERE daywork_id = #{dayworkId}
|
|
|
ORDER BY create_time
|
|
|
LIMIT 1
|
|
|
</select>
|
|
|
<select id="getProcessAlias" resultType="String">
|
|
|
- SELECT process_alias FROM biz_process t1 LEFT JOIN biz_daywork_item t2 ON t1.id =
|
|
|
- t2.process_id WHERE t2.daywork_id = #{id} ORDER BY t2.create_time DESC LIMIT 1
|
|
|
+ SELECT process_alias
|
|
|
+ FROM biz_process t1
|
|
|
+ LEFT JOIN biz_daywork_item t2 ON t1.id =
|
|
|
+ t2.process_id
|
|
|
+ WHERE t2.daywork_id = #{id}
|
|
|
+ ORDER BY t2.create_time DESC
|
|
|
+ LIMIT 1
|
|
|
</select>
|
|
|
<select id="getTotalWorkingHours" resultType="long">
|
|
|
- SELECT sum(working_hours) FROM biz_daywork_item WHERE daywork_id = #{id} AND dept_id = #{deptId} AND deleted = 0
|
|
|
+ SELECT sum(working_hours)
|
|
|
+ FROM biz_daywork_item
|
|
|
+ WHERE daywork_id = #{id}
|
|
|
+ AND dept_id = #{deptId}
|
|
|
+ AND deleted = 0
|
|
|
</select>
|
|
|
<select id="getLastLotQuantity" resultType="java.lang.Integer">
|
|
|
- SELECT last_lot_quantity FROM biz_production_plan_detail WHERE deleted = 0 AND id = #{productionPlanDetailId}
|
|
|
+ SELECT last_lot_quantity
|
|
|
+ FROM biz_production_plan_detail
|
|
|
+ WHERE deleted = 0
|
|
|
+ AND id = #{productionPlanDetailId}
|
|
|
</select>
|
|
|
<select id="getRejectNum" resultType="int">
|
|
|
- SELECT sum(reject_num) rejectNum FROM biz_daywork_item_reject WHERE daywork_item_id = #{id} AND deleted = 0
|
|
|
+ SELECT sum(reject_num) rejectNum
|
|
|
+ FROM biz_daywork_item_reject
|
|
|
+ WHERE daywork_item_id = #{id}
|
|
|
+ AND deleted = 0
|
|
|
</select>
|
|
|
<select id="getProcessList" resultType="cn.ezhizao.project.business.domain.BizProcess">
|
|
|
- SELECT id AS Value,process_alias AS Label
|
|
|
+ SELECT id AS Value, process_alias AS Label
|
|
|
FROM biz_process
|
|
|
- WHERE
|
|
|
- deleted = 0 AND
|
|
|
- tenant_id !=9 AND
|
|
|
- id IN (
|
|
|
- SELECT process_id
|
|
|
- FROM biz_technological_process_detail
|
|
|
- WHERE
|
|
|
- deleted = 0 AND
|
|
|
- tenant_id !=9 AND
|
|
|
- technological_process_id = #{technologicalProcessId}
|
|
|
- )
|
|
|
+ WHERE deleted = 0
|
|
|
+ AND tenant_id != 9
|
|
|
+ AND id IN (SELECT process_id
|
|
|
+ FROM biz_technological_process_detail
|
|
|
+ WHERE deleted = 0
|
|
|
+ AND tenant_id != 9
|
|
|
+ AND technological_process_id = #{technologicalProcessId})
|
|
|
</select>
|
|
|
<select id="getList" resultMap="BizDayworkResult">
|
|
|
SELECT
|
|
@@ -185,10 +204,10 @@
|
|
|
t1.is_waste_recycling,
|
|
|
t1.is_amend
|
|
|
FROM biz_daywork t1
|
|
|
- LEFT JOIN biz_lot t3 ON t1.lot_id = t3.id
|
|
|
- LEFT JOIN biz_production_plan_detail t4 ON t1.production_plan_detail_id = t4.id
|
|
|
- LEFT JOIN biz_product t2 ON t4.product_id = t2.id
|
|
|
- LEFT JOIN sys_dept t5 ON t1.dept_id = t5.dept_id
|
|
|
+ LEFT JOIN biz_lot t3 ON t1.lot_id = t3.id
|
|
|
+ LEFT JOIN biz_production_plan_detail t4 ON t1.production_plan_detail_id = t4.id
|
|
|
+ LEFT JOIN biz_product t2 ON t4.product_id = t2.id
|
|
|
+ LEFT JOIN sys_dept t5 ON t1.dept_id = t5.dept_id
|
|
|
|
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
t1.deleted = 0
|
|
@@ -216,35 +235,54 @@
|
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
t1.deleted = 0
|
|
|
<if test="keyword != null and keyword != ''">
|
|
|
- AND (t4.product_description LIKE CONCAT('%', #{keyword}, '%') OR t1.lot_code LIKE CONCAT('%', #{keyword}, '%'))
|
|
|
+ AND (t4.product_description LIKE CONCAT('%', #{keyword}, '%') OR t1.lot_code LIKE CONCAT('%',
|
|
|
+ #{keyword}, '%'))
|
|
|
</if>
|
|
|
</trim>
|
|
|
ORDER BY t1.create_time DESC
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="selectScreenDaywork" resultMap="BizDayworkResult" parameterType="list">
|
|
|
+ SELECT
|
|
|
+ d.*,
|
|
|
+ (SELECT status FROM biz_daywork_item WHERE daywork_id=d.id AND deleted=0 ORDER BY create_time DESC LIMIT 1)AS item_status,
|
|
|
+ (SELECT technological_process_detail_id FROM biz_daywork_item WHERE daywork_id=d.id AND deleted=0 ORDER BY create_time DESC LIMIT 1)AS special_process_id
|
|
|
+ FROM
|
|
|
+ biz_daywork d
|
|
|
+ WHERE
|
|
|
+ d.id IN
|
|
|
+ <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ AND
|
|
|
+ d.deleted = 0
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
<select id="getOriginalCarrierList" resultType="cn.ezhizao.project.business.domain.BizDayworkCarrier">
|
|
|
SELECT t1.*
|
|
|
FROM biz_daywork_carrier t1
|
|
|
WHERE t1.daywork_id = #{id}
|
|
|
- AND t1.is_changed=0
|
|
|
- AND t1.deleted = 0
|
|
|
+ AND t1.is_changed = 0
|
|
|
+ AND t1.deleted = 0
|
|
|
</select>
|
|
|
<select id="getListForOutsource" resultMap="BizDayworkResultForOutsource">
|
|
|
SELECT
|
|
|
- t1.*,
|
|
|
- t2.product_code,
|
|
|
- t2.description AS product_description,
|
|
|
- t3.technology_version,
|
|
|
- (
|
|
|
- SELECT
|
|
|
- GROUP_CONCAT(carrier_code ORDER BY carrier_code SEPARATOR ',')
|
|
|
- FROM biz_daywork_carrier
|
|
|
- WHERE daywork_id = t1.id
|
|
|
- AND is_changed=0
|
|
|
- AND deleted = 0
|
|
|
- ) AS original_carrier
|
|
|
+ t1.*,
|
|
|
+ t2.product_code,
|
|
|
+ t2.description AS product_description,
|
|
|
+ t3.technology_version,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ GROUP_CONCAT(carrier_code ORDER BY carrier_code SEPARATOR ',')
|
|
|
+ FROM biz_daywork_carrier
|
|
|
+ WHERE daywork_id = t1.id
|
|
|
+ AND is_changed=0
|
|
|
+ AND deleted = 0
|
|
|
+ ) AS original_carrier
|
|
|
FROM biz_daywork t1
|
|
|
- LEFT JOIN biz_product t2 ON t1.product_id = t2.id
|
|
|
- LEFT JOIN biz_technological_process t3 ON t1.technological_process_id=t3.id
|
|
|
+ LEFT JOIN biz_product t2 ON t1.product_id = t2.id
|
|
|
+ LEFT JOIN biz_technological_process t3 ON t1.technological_process_id=t3.id
|
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
t1.deleted = 0
|
|
|
<if test="tenantId != null and tenantId != 0">AND t1.tenant_id = #{tenantId}</if>
|
|
@@ -268,75 +306,88 @@
|
|
|
t2.description LIKE concat('%', #{keyword}, '%'))
|
|
|
</if>
|
|
|
<if test="isSupplierProducts == 1 and supplierId != null and supplierId != ''">
|
|
|
- AND t1.product_id IN (SELECT product_id FROM biz_supplier_product WHERE supplier_id=#{supplierId} AND deleted=0)
|
|
|
+ AND t1.product_id IN (SELECT product_id FROM biz_supplier_product WHERE supplier_id=#{supplierId} AND
|
|
|
+ deleted=0)
|
|
|
</if>
|
|
|
</trim>
|
|
|
ORDER BY t1.create_time DESC
|
|
|
</select>
|
|
|
-<!-- 之前遗留暂时注释
|
|
|
- <select id="getItemList" parameterType="BizDayworkItem" resultMap="BizDayworkItemResult">
|
|
|
- SELECT
|
|
|
- DISTINCT
|
|
|
- t1.id,
|
|
|
- t1.start_time,
|
|
|
- t1.end_time,
|
|
|
- t1.daywork_id,
|
|
|
- t1.working_hours,
|
|
|
- t1.status,
|
|
|
- t1.prod_num,
|
|
|
- t1.qualified_num,
|
|
|
- t2.nick_name,
|
|
|
- t1.process_id,
|
|
|
- t2.user_name,
|
|
|
- t4.process_alias ,
|
|
|
- t4.process_code,
|
|
|
- t1.equipment_detail_id,
|
|
|
- t1.equipment_detail_code,
|
|
|
- t4.technological_process_id
|
|
|
- FROM biz_daywork_item t1
|
|
|
- LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
|
|
|
- LEFT JOIN biz_technological_process_detail t4 ON t1.technological_process_id = t4.technological_process_id and
|
|
|
- t1.process_id = t4.process_id
|
|
|
+ <!-- 之前遗留暂时注释
|
|
|
+ <select id="getItemList" parameterType="BizDayworkItem" resultMap="BizDayworkItemResult">
|
|
|
+ SELECT
|
|
|
+ DISTINCT
|
|
|
+ t1.id,
|
|
|
+ t1.start_time,
|
|
|
+ t1.end_time,
|
|
|
+ t1.daywork_id,
|
|
|
+ t1.working_hours,
|
|
|
+ t1.status,
|
|
|
+ t1.prod_num,
|
|
|
+ t1.qualified_num,
|
|
|
+ t2.nick_name,
|
|
|
+ t1.process_id,
|
|
|
+ t2.user_name,
|
|
|
+ t4.process_alias ,
|
|
|
+ t4.process_code,
|
|
|
+ t1.equipment_detail_id,
|
|
|
+ t1.equipment_detail_code,
|
|
|
+ t4.technological_process_id
|
|
|
+ FROM biz_daywork_item t1
|
|
|
+ LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
|
|
|
+ LEFT JOIN biz_technological_process_detail t4 ON t1.technological_process_id = t4.technological_process_id and
|
|
|
+ t1.process_id = t4.process_id
|
|
|
|
|
|
- <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
- t1.deleted = 0 and t1.status < 4
|
|
|
- <if test="dayworkId != null and dayworkId != 0">AND t1.daywork_id = #{dayworkId}</if>
|
|
|
- <if test="processId != null">AND t1.process_id = #{processId}</if>
|
|
|
- <if test="isAmend != null and isAmend != 0">AND t1.form_daywork_item_id !=0 </if>
|
|
|
- ORDER BY t1.process_step_number ASC ,t1.start_time DESC
|
|
|
+ <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
t1.deleted = 0 and t1.status < 4
|
|
|
<if test="dayworkId != null and dayworkId != 0">AND t1.daywork_id = #{dayworkId}</if>
|
|
|
- <if test="tenantId != null and tenantId != 0">AND t1.tenant_id = #{tenantId}</if>
|
|
|
- <if test="processId != null and processId != 0">AND t1.process_id = #{processId}</if>
|
|
|
- # and t4.process_id = t1.process_id
|
|
|
- </trim>
|
|
|
- ORDER BY t4.process_step_number ASC ,t1.start_time DESC
|
|
|
-</select>-->
|
|
|
+ <if test="processId != null">AND t1.process_id = #{processId}</if>
|
|
|
+ <if test="isAmend != null and isAmend != 0">AND t1.form_daywork_item_id !=0 </if>
|
|
|
+ ORDER BY t1.process_step_number ASC ,t1.start_time DESC
|
|
|
+ t1.deleted = 0 and t1.status < 4
|
|
|
+ <if test="dayworkId != null and dayworkId != 0">AND t1.daywork_id = #{dayworkId}</if>
|
|
|
+ <if test="tenantId != null and tenantId != 0">AND t1.tenant_id = #{tenantId}</if>
|
|
|
+ <if test="processId != null and processId != 0">AND t1.process_id = #{processId}</if>
|
|
|
+ # and t4.process_id = t1.process_id
|
|
|
+ </trim>
|
|
|
+ ORDER BY t4.process_step_number ASC ,t1.start_time DESC
|
|
|
+ </select>-->
|
|
|
<select id="getItemList" parameterType="BizDayworkItem" resultMap="BizDayworkItemResult">
|
|
|
SELECT
|
|
|
- t1.*,
|
|
|
- t2.user_name
|
|
|
+ t1.*,
|
|
|
+ t2.user_name
|
|
|
FROM biz_daywork_item t1
|
|
|
- LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
|
|
|
+ LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
|
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
t1.deleted = 0 AND t1.status < 4
|
|
|
<if test="dayworkId != null and dayworkId != 0">AND t1.daywork_id = #{dayworkId}</if>
|
|
|
- <if test="isAmend != null and isAmend != 0">AND t1.form_daywork_item_id !=0 </if>
|
|
|
+ <if test="isAmend != null and isAmend != 0">AND t1.form_daywork_item_id !=0</if>
|
|
|
<if test="processId != null and processId != 0">AND t1.process_id = #{processId}</if>
|
|
|
ORDER BY t1.process_step_number ASC ,t1.create_time ASC
|
|
|
</trim>
|
|
|
</select>
|
|
|
<select id="getProcessName" resultType="java.lang.String">
|
|
|
- select process_alias from biz_technological_process_detail where deleted = 0 and id = #{technologicalProcessDetailId}
|
|
|
+ select process_alias
|
|
|
+ from biz_technological_process_detail
|
|
|
+ where deleted = 0
|
|
|
+ and id = #{technologicalProcessDetailId}
|
|
|
</select>
|
|
|
<select id="getProductDescription" resultType="java.lang.String">
|
|
|
- select product_description from biz_production_plan_detail where deleted = 0 and id = #{productionPlanDetailId}
|
|
|
+ select product_description
|
|
|
+ from biz_production_plan_detail
|
|
|
+ where deleted = 0
|
|
|
+ and id = #{productionPlanDetailId}
|
|
|
</select>
|
|
|
<select id="getTechnologyVersion" resultType="java.lang.String">
|
|
|
- select technology_version from biz_lot where deleted = 0 and id = #{lotId}
|
|
|
+ select technology_version
|
|
|
+ from biz_lot
|
|
|
+ where deleted = 0
|
|
|
+ and id = #{lotId}
|
|
|
</select>
|
|
|
<select id="getLotCode" resultType="java.lang.String">
|
|
|
- select lot_code from biz_lot where deleted = 0 and id = #{lotId}
|
|
|
+ select lot_code
|
|
|
+ from biz_lot
|
|
|
+ where deleted = 0
|
|
|
+ and id = #{lotId}
|
|
|
</select>
|
|
|
|
|
|
<select id="listReportItem" parameterType="BizDayworkItem" resultMap="BizDayworkItemResult">
|
|
@@ -349,7 +400,7 @@
|
|
|
GROUP_CONCAT(carrier_code ORDER BY carrier_code SEPARATOR ',')
|
|
|
FROM biz_daywork_carrier
|
|
|
WHERE daywork_id = t1.daywork_id
|
|
|
- AND is_changed=0
|
|
|
+ AND is_changed=0
|
|
|
AND deleted = 0
|
|
|
) AS original_carrier
|
|
|
FROM biz_daywork_item t1
|
|
@@ -359,13 +410,21 @@
|
|
|
t1.deleted = 0 AND t1.status < 4
|
|
|
<if test="dayworkId != null and dayworkId != 0">AND t1.daywork_id = #{dayworkId}</if>
|
|
|
<if test="deptId != null and deptId != 0">AND t1.dept_id = #{deptId}</if>
|
|
|
- <if test="isAmend != null and isAmend != 0">AND t1.form_daywork_item_id !=0 </if>
|
|
|
+ <if test="isAmend != null and isAmend != 0">AND t1.form_daywork_item_id !=0</if>
|
|
|
<if test="startTime != null ">AND t1.end_time >= #{startTime}</if>
|
|
|
<if test="endTime != null ">AND t1.end_time <= #{endTime}</if>
|
|
|
- <if test="productDescription != null and productDescription != ''">AND t1.production_plan_detail_id in (select id from biz_production_plan_detail where deleted = 0 and product_description LIKE CONCAT('%', #{productDescription}, '%'))</if>
|
|
|
- <if test="lotCode != null and lotCode != ''">AND t1.lot_id in (select id from biz_lot where deleted = 0 and lot_code LIKE CONCAT('%', #{lotCode}, '%'))</if>
|
|
|
- <if test="nickName != null and nickName != ''">AND t1.nick_name LIKE CONCAT('%', #{nickName}, '%')</if>
|
|
|
- <if test="originalCarrier != null and originalCarrier != ''">AND t1.daywork_id in (select daywork_id from biz_daywork_carrier where deleted = 0 AND is_changed=0 and carrier_code LIKE CONCAT('%', #{originalCarrier}, '%')) </if>
|
|
|
+ <if test="productDescription != null and productDescription != ''">AND t1.production_plan_detail_id in
|
|
|
+ (select id from biz_production_plan_detail where deleted = 0 and product_description LIKE CONCAT('%',
|
|
|
+ #{productDescription}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="lotCode != null and lotCode != ''">AND t1.lot_id in (select id from biz_lot where deleted = 0 and
|
|
|
+ lot_code LIKE CONCAT('%', #{lotCode}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="nickName != null and nickName != ''">AND t1.nick_name LIKE CONCAT('%', #{nickName}, '%')</if>
|
|
|
+ <if test="originalCarrier != null and originalCarrier != ''">AND t1.daywork_id in (select daywork_id from
|
|
|
+ biz_daywork_carrier where deleted = 0 AND is_changed=0 and carrier_code LIKE CONCAT('%',
|
|
|
+ #{originalCarrier}, '%'))
|
|
|
+ </if>
|
|
|
<if test="processId != null and processId != 0">AND t1.process_id = #{processId}</if>
|
|
|
ORDER BY t1.lot_id, t1.end_time DESC
|
|
|
</trim>
|
|
@@ -405,8 +464,10 @@
|
|
|
biz_daywork_item.create_time DESC
|
|
|
LIMIT 1
|
|
|
) AS processAlias,
|
|
|
- ( SELECT place FROM biz_daywork_item WHERE biz_daywork_item.daywork_id = t1.id ORDER BY biz_daywork_item.create_time DESC LIMIT 1 ) AS place,
|
|
|
- ( SELECT turnover_area FROM biz_daywork_item WHERE biz_daywork_item.daywork_id = t1.id ORDER BY biz_daywork_item.create_time DESC LIMIT 1 ) AS turnoverArea,
|
|
|
+ ( SELECT place FROM biz_daywork_item WHERE biz_daywork_item.daywork_id = t1.id ORDER BY
|
|
|
+ biz_daywork_item.create_time DESC LIMIT 1 ) AS place,
|
|
|
+ ( SELECT turnover_area FROM biz_daywork_item WHERE biz_daywork_item.daywork_id = t1.id ORDER BY
|
|
|
+ biz_daywork_item.create_time DESC LIMIT 1 ) AS turnoverArea,
|
|
|
(
|
|
|
SELECT
|
|
|
GROUP_CONCAT( carrier_code ORDER BY carrier_code SEPARATOR ',' )
|
|
@@ -443,21 +504,22 @@
|
|
|
AND biz_daywork_carrier.is_changed = 0
|
|
|
AND biz_daywork_carrier.deleted = 0
|
|
|
and biz_daywork_carrier.carrier_code like concat('%',#{carrierCode},'%')
|
|
|
- )</if>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</select>
|
|
|
|
|
|
-<!-- -->
|
|
|
+ <!-- -->
|
|
|
<select id="getItemListForOutsource" parameterType="BizDayworkItem" resultMap="BizDayworkItemResultForOutsource">
|
|
|
SELECT
|
|
|
- t1.*
|
|
|
+ t1.*
|
|
|
FROM biz_daywork_item t1
|
|
|
- LEFT JOIN sys_dept t2 ON t1.dept_id=t2.dept_id
|
|
|
- LEFT JOIN biz_daywork t3 ON t1.daywork_id = t3.id
|
|
|
+ LEFT JOIN sys_dept t2 ON t1.dept_id=t2.dept_id
|
|
|
+ LEFT JOIN biz_daywork t3 ON t1.daywork_id = t3.id
|
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
t1.deleted = 0 AND
|
|
|
t1.status >= 4 AND
|
|
|
-# 查找创建时间最新的一条
|
|
|
+ # 查找创建时间最新的一条
|
|
|
t1.create_time = (
|
|
|
SELECT MAX(t5.create_time)
|
|
|
FROM biz_daywork_item t5
|
|
@@ -465,7 +527,8 @@
|
|
|
)
|
|
|
<if test="deptCode != null and deptCode != ''">AND t2.dept_code = #{deptCode}</if>
|
|
|
<if test="isSupplierProducts != null and isSupplierProducts != 1 ">
|
|
|
- AND t3.product_id IN (SELECT product_id FROM biz_supplier_product WHERE supplier_id=#{supplierId} AND deleted=0)
|
|
|
+ AND t3.product_id IN (SELECT product_id FROM biz_supplier_product WHERE supplier_id=#{supplierId} AND
|
|
|
+ deleted=0)
|
|
|
</if>
|
|
|
|
|
|
ORDER BY t1.process_step_number ASC
|
|
@@ -474,28 +537,24 @@
|
|
|
|
|
|
|
|
|
<select id="getDeptList" resultType="cn.ezhizao.project.system.domain.SysDept">
|
|
|
- SELECT DISTINCT
|
|
|
- t3.dept_id AS Value,
|
|
|
- t3.dept_name AS Label
|
|
|
+ SELECT DISTINCT t3.dept_id AS Value,
|
|
|
+ t3.dept_name AS Label
|
|
|
FROM biz_daywork t1
|
|
|
- LEFT JOIN biz_production_plan_detail t2 ON t2.id = t1.production_plan_detail_id
|
|
|
- LEFT JOIN sys_dept t3 ON t1.dept_id = t3.dept_id
|
|
|
- WHERE
|
|
|
- t2.production_plan_no = #{productionPlanNo} AND
|
|
|
- t2.line_number = #{lineNumber}
|
|
|
+ LEFT JOIN biz_production_plan_detail t2 ON t2.id = t1.production_plan_detail_id
|
|
|
+ LEFT JOIN sys_dept t3 ON t1.dept_id = t3.dept_id
|
|
|
+ WHERE t2.production_plan_no = #{productionPlanNo}
|
|
|
+ AND t2.line_number = #{lineNumber}
|
|
|
</select>
|
|
|
|
|
|
<select id="getDayworkProcessList" resultType="cn.ezhizao.project.business.domain.BizProcess">
|
|
|
- SELECT DISTINCT
|
|
|
- t3.id AS Value,
|
|
|
- t3.process_alias AS Label
|
|
|
+ SELECT DISTINCT t3.id AS Value,
|
|
|
+ t3.process_alias AS Label
|
|
|
FROM biz_daywork t1
|
|
|
- LEFT JOIN biz_daywork_item t2 ON t1.id = t2.daywork_id
|
|
|
- LEFT JOIN biz_process t3 ON t2.process_id = t3.id
|
|
|
- WHERE
|
|
|
- t1.id = #{id} AND
|
|
|
- t2.dept_id = #{deptId} AND
|
|
|
- t2.status < 4
|
|
|
+ LEFT JOIN biz_daywork_item t2 ON t1.id = t2.daywork_id
|
|
|
+ LEFT JOIN biz_process t3 ON t2.process_id = t3.id
|
|
|
+ WHERE t1.id = #{id}
|
|
|
+ AND t2.dept_id = #{deptId}
|
|
|
+ AND t2.status < 4
|
|
|
ORDER BY t2.create_time
|
|
|
</select>
|
|
|
|