|
|
|
@ -2,6 +2,64 @@ |
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
|
|
<mapper namespace="com.gaotao.modules.shopOrder.dao.WorkOrderAllocMapper"> |
|
|
|
|
|
|
|
<sql id="searchShopOrderForAllocBaseConditions"> |
|
|
|
and T.site in (Select Site from AccessSite where upper(UserID)=#{query.user}) |
|
|
|
<if test="query.orderType != null and query.orderType != ''"> |
|
|
|
AND T.OrderType like '%' + #{query.orderType} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.planner != null and query.planner != ''"> |
|
|
|
AND T.Planner like '%' + #{query.planner} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.site != null and query.site != ''"> |
|
|
|
AND T.Site like '%' + #{query.site} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.buNo != null and query.buNo != ''"> |
|
|
|
AND T.bu_no like '%' + #{query.buNo} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.partType != null and query.partType != ''"> |
|
|
|
AND p.PartType like '%' + #{query.partType} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.partNo != null and query.partNo != ''"> |
|
|
|
AND T.PartNo like '%' + #{query.partNo} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.status != null and query.status != ''"> |
|
|
|
AND T.Status = #{query.status} |
|
|
|
</if> |
|
|
|
<if test="query.statusList != null and query.statusList.size > 0"> |
|
|
|
AND T.Status in |
|
|
|
<foreach item="item" collection="query.statusList" open="(" separator="," close=")"> |
|
|
|
#{item} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="query.partDescription != null and query.partDescription != ''"> |
|
|
|
AND p.PartDescription like '%' + #{query.partDescription} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.projectID != null and query.projectID != ''"> |
|
|
|
AND T.ProjectID like '%' + #{query.projectID} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.remark != null and query.remark != ''"> |
|
|
|
AND T.Remark like '%' + #{query.remark} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.orderRef1 != null and query.orderRef1 != ''"> |
|
|
|
AND T.OrderRef1 like '%' + #{query.orderRef1} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.costRollUpFlag != null and query.costRollUpFlag != ''"> |
|
|
|
AND CostRollUpFlag like '%' + #{query.costRollUpFlag} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.date1 != null"> |
|
|
|
AND T.EnterDate >= #{query.date1} |
|
|
|
</if> |
|
|
|
<if test="query.date2 != null"> |
|
|
|
AND dateadd(DAY, 1, #{query.date2}) > T.EnterDate |
|
|
|
</if> |
|
|
|
<if test="query.date3 != null"> |
|
|
|
AND T.NeedDate >= #{query.date3} |
|
|
|
</if> |
|
|
|
<if test="query.date4 != null"> |
|
|
|
AND dateadd(DAY, 1, #{query.date4}) > T.NeedDate |
|
|
|
</if> |
|
|
|
</sql> |
|
|
|
|
|
|
|
<!-- 分页查询生产订单(工单数据汇总专用) --> |
|
|
|
<select id="searchShopOrderForAlloc" parameterType="com.gaotao.modules.shopOrder.entity.SearchShopOrder" resultType="com.gaotao.modules.shopOrder.entity.SearchShopOrder"> |
|
|
|
Select |
|
|
|
@ -60,66 +118,39 @@ |
|
|
|
left join Project as pr on pr.Site=T.Site and pr.Projectid=T.ProjectID |
|
|
|
<where> |
|
|
|
AND T.Site = p.Site and T.PartNo = p.PartNo |
|
|
|
and T.site in (Select Site from AccessSite where upper(UserID)=#{query.user}) |
|
|
|
<if test="query.orderType != null and query.orderType != ''"> |
|
|
|
AND T.OrderType like '%' + #{query.orderType} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.planner != null and query.planner != ''"> |
|
|
|
AND T.Planner like '%' + #{query.planner} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.site != null and query.site != ''"> |
|
|
|
AND T.Site like '%' + #{query.site} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.buNo != null and query.buNo != ''"> |
|
|
|
AND T.bu_no like '%' + #{query.buNo} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.partType != null and query.partType != ''"> |
|
|
|
AND P.PartType like '%' + #{query.partType} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.partNo != null and query.partNo != ''"> |
|
|
|
AND T.PartNo like '%' + #{query.partNo} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.status != null and query.status != ''"> |
|
|
|
AND T.Status = #{query.status} |
|
|
|
</if> |
|
|
|
<if test="query.statusList != null and query.statusList.size > 0"> |
|
|
|
AND T.Status in |
|
|
|
<foreach item="item" collection="query.statusList" open="(" separator="," close=")"> |
|
|
|
<include refid="searchShopOrderForAllocBaseConditions"/> |
|
|
|
<choose> |
|
|
|
<when test="query.orderNoList != null and query.orderNoList.size > 0"> |
|
|
|
AND T.OrderNo in |
|
|
|
<foreach item="item" collection="query.orderNoList" open="(" separator="," close=")"> |
|
|
|
#{item} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="query.partDescription != null and query.partDescription != ''"> |
|
|
|
AND p.PartDescription like '%' + #{query.partDescription} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.projectID != null and query.projectID != ''"> |
|
|
|
AND T.ProjectID like '%' + #{query.projectID} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.remark != null and query.remark != ''"> |
|
|
|
AND T.Remark like '%' + #{query.remark} + '%' |
|
|
|
</if> |
|
|
|
</when> |
|
|
|
<otherwise> |
|
|
|
<if test="query.orderNo != null and query.orderNo != ''"> |
|
|
|
AND T.OrderNo like '%' + #{query.orderNo} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.orderRef1 != null and query.orderRef1 != ''"> |
|
|
|
AND T.OrderRef1 like '%' + #{query.orderRef1} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.costRollUpFlag != null and query.costRollUpFlag != ''"> |
|
|
|
AND CostRollUpFlag like '%' + #{query.costRollUpFlag} + '%' |
|
|
|
</if> |
|
|
|
<if test="query.date1 != null"> |
|
|
|
AND T.EnterDate >= #{query.date1} |
|
|
|
</if> |
|
|
|
<if test="query.date2 != null"> |
|
|
|
AND dateadd(DAY, 1, #{query.date2}) > T.EnterDate |
|
|
|
</if> |
|
|
|
<if test="query.date3 != null"> |
|
|
|
AND T.NeedDate >= #{query.date3} |
|
|
|
</otherwise> |
|
|
|
</choose> |
|
|
|
</where> |
|
|
|
ORDER BY T.EnterDate DESC |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 根据报工日期查询工单号集合 --> |
|
|
|
<select id="selectOrderNosByReportDate" parameterType="com.gaotao.modules.shopOrder.entity.SearchShopOrder" resultType="java.lang.String"> |
|
|
|
SELECT DISTINCT T.OrderNo |
|
|
|
FROM ShopOrder T |
|
|
|
INNER JOIN SFDC B ON T.Site = B.Site AND T.OrderNo = B.OrderNo |
|
|
|
INNER JOIN Part p ON T.Site = p.Site AND T.PartNo = p.PartNo |
|
|
|
<where> |
|
|
|
<include refid="searchShopOrderForAllocBaseConditions"/> |
|
|
|
<if test="query.reportDate1 != null"> |
|
|
|
AND B.ReportDate >= #{query.reportDate1} |
|
|
|
</if> |
|
|
|
<if test="query.date4 != null"> |
|
|
|
AND dateadd(DAY, 1, #{query.date4}) > T.NeedDate |
|
|
|
<if test="query.reportDate2 != null"> |
|
|
|
AND dateadd(DAY, 1, #{query.reportDate2}) > B.ReportDate |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
ORDER BY T.EnterDate DESC |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 根据allocType查询工单汇总数据 --> |
|
|
|
|