@ -130,47 +130,103 @@
<!-- </select> -->
<select id= "searchProductionLineOutputReport" resultType= "com.gaotao.modules.shopOrder.entity.SearchProductionLineOutputReportData" >
Select T.Site,T.OrderNo,T.ItemNo,T.SeqNo,T.ReportDate,T.OperatorID,T.Direction,T.ReportQty,T.ApproveQty,Round(T.ReportedSetupTime,2) as reportedSetupTime,R.WorkcenterNo,W.WorkCenterDesc,O.OperatorName
,Round(T.ReportedManfTime,2) as reportedManfTime,T.ReportedCleanupTime,T.ScrapReason,T.DownTimeReason,T.Reverseflag,T.RelevantSeqNo,T.Remark
,T.starttime,T.finishtime,T.downtime,T.AssJobSeqNo,(T.ReportQty - T.ApproveQty) as DefectQty
,R.OperationDesc,SS.QtyRequired,SS.S_ResourceID,T.RollNo,T.Scheduled_ShiftNo,T.Scheduled_Date,T.FirstReportFlag,T.ReportedSetupDowntime ,T.ReportedManfDowntime
,S.PartNo,p.PartDescription+' / '+p.Spec as PartDescription,P.ConfigurationTemplateID as CustomerName,
P.Remark as CustPartNo,Round((case when T.ReportedManfTime=0 then 999999 else T.ApproveQty / T.ReportedManfTime end),2) as ActRunRate,s.NeedDate
from SFDC as T
left join SOScheduledRouting as SS on T.Site=SS.Site and T.OrderNo=SS.OrderNo and T.ItemNo=SS.ItemNo and T.AssJobSeqNo=SS.SeqNo
,ShopOrder as S,SORouting as R,Part as P,WorkCenter as W,Operator as O
SELECT
T.Site,
T.OrderNo,
T.ItemNo,
T.SeqNo,
T.ReportDate,
T.OperatorID,
T.Direction,
T.ReportQty,
T.ApproveQty,
Round(T.ReportedSetupTime, 2) AS reportedSetupTime,
R.WorkcenterNo,
W.WorkCenterDesc,
O.OperatorName,
Round(T.ReportedManfTime, 2) AS reportedManfTime,
T.ReportedCleanupTime,
T.ScrapReason,
T.DownTimeReason,
T.Reverseflag,
T.RelevantSeqNo,
T.Remark,
T.starttime,
T.finishtime,
T.downtime,
T.AssJobSeqNo,
(T.ReportQty - T.ApproveQty) AS DefectQty,
R.OperationDesc,
SS.QtyRequired,
SS.S_ResourceID,
T.RollNo,
T.Scheduled_ShiftNo,
T.Scheduled_Date,
T.FirstReportFlag,
T.ReportedSetupDowntime,
T.ReportedManfDowntime,
S.PartNo,
p.PartDescription AS PartDescription,
p.Spec as spec,
P.ConfigurationTemplateID AS CustomerName,
P.Remark AS CustPartNo,
Round(
(
CASE
WHEN T.ReportedManfTime = 0 THEN
999999
ELSE
T.ApproveQty / T.ReportedManfTime
END
),
2
) AS ActRunRate,
s.NeedDate
FROM SFDC AS T
LEFT JOIN SOScheduledRouting AS SS ON T.Site = SS.Site AND T.OrderNo = SS.OrderNo AND T.ItemNo = SS.ItemNo AND T.AssJobSeqNo = SS.SeqNo,
ShopOrder AS S,
SORouting AS R,
Part AS P,
WorkCenter AS W,
Operator AS O
<where >
and T.Site=S.Site and T.OrderNo=S.OrderNo and T.Site=R.Site and T.OrderNo=R.OrderNo and T.ItemNo=R.ItemNo and s.Site=p.Site
and s.PartNo=p.PartNo and R.Site=W.Site and R.WorkCenterNo=W.WorkCenterNo and T.Site=O.Site and T.OperatorID=O.OperatorID
and T.Site=R.Site and T.OrderNo=R.OrderNo and T.ItemNo=R.ItemNo
and T.Site in (Select Site from AccessSite where upper(UserID)=#{user})
and T.Site = S.Site and T.OrderNo = S.OrderNo and T.Site = R.Site and T.OrderNo = R.OrderNo and T.ItemNo = R.ItemNo and s.Site = p.Site
and s.PartNo = p.PartNo and R.Site = W.Site and R.WorkCenterNo = W.WorkCenterNo and T.Site = O.Site and T.OperatorID = O.OperatorID
and T.Site = R.Site and T.OrderNo = R.OrderNo and T.ItemNo = R.ItemNo
and T.Site in (Select Site from AccessSite where upper(UserID) = #{user})
AND T.Reverseflag = 'N'
<if test= " site != null and site != ''" >
AND T.Site = #{site}
</if>
<if test= " partNo != null and partNo != ''" >
<if test= " partNo != null and partNo != ''" >
AND s.PartNo like '%' + #{partNo} + '%'
</if>
<if test= " partDescription != null and partDescription != ''" >
AND p.PartDescription+' / '+p.Spec like '%' + #{partDescription} + '%'
<if test= " partDescription != null and partDescription != ''" >
AND p.PartDescription like '%' + #{partDescription} + '%'
</if>
<if test= " spec != null and spec != ''" >
AND p.Spec like '%' + #{spec} + '%'
</if>
<if test= " orderNo != null and orderNo != ''" >
AND T.OrderNo = #{orderNo}
AND T.OrderNo like '%' + #{orderNo} + '%'
</if>
<if test= " operatorID != null and operatorID != ''" >
<if test= " operatorID != null and operatorID != ''" >
AND T.OperatorID like '%' + #{operatorID} + '%'
</if>
<if test= " workCenterNo != null and workCenterNo != ''" >
<if test= " workCenterNo != null and workCenterNo != ''" >
AND R.WorkcenterNo like '%' + #{workCenterNo} + '%'
</if>
<if test= " workCenterDesc != null and workCenterDesc != ''" >
AND W.WorkCenterDesc like '%' + #{workCenterDesc} + '%'
</if>
<if test= " sResourceID != null and sResourceID != ''" >
AND SS.S_ResourceID like '%' + #{sResourceID} + '%'
</if>
<if test= " date1 != null " >
<if test= " date1 != null " >
AND T.ReportDate >= #{date1}
</if>
<if test= " date2 != null " >
AND dateadd( DAY, 1, #{date2} ) > T.ReportDate
<if test= " date2 != null " >
AND dateadd(DAY, 1, #{date2}) > T.ReportDate
</if>
</where>
ORDER BY T.ReportDate DESC, T.OrderNo, T.ItemNo, T.SeqNo