|
|
<?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"><mapper namespace="com.srq.modules.schedule.dao.ScheduleMapper"> <select id="getShopOrderRoutingData" resultType="com.srq.modules.schedule.entity.ShopOrderRoutingData"> SELECT so.Site,so.OrderNo ,so.NeedDate,so.Status,so.LotSize,so.PartNo,sr.ItemNo,sr.OperationDesc, sr.WorkCenterNo,p.PartDesc,isnull(sl.QtyScheduled,0) QtyScheduled,isnull(sl.QtyReported,0) QtyReported, so.EnterDate FROM view_ShopOrder so LEFT JOIN view_SORouting sr on so.site=sr.Site and so.OrderNo=sr.OrderNo left join view_Part p on so.site=P.Site and so.PartNo=p.PartNo left join so_schedule_list sl on sl.Site=so.Site and sl.OrderNo=so.OrderNo and sr.ItemNo=sl.ItemNo <where> and so.site=#{site} <if test="startDate1 != null"> and so.EnterDate>=#{startDate1} </if> <if test="endDate1 != null"> and #{endDate1}>=so.EnterDate </if> <if test="startDate2 != null"> and so.NeedDate>=#{startDate2} </if> <if test="endDate2 != null"> and #{endDate2}>=so.NeedDate </if> <if test="itemNo != null"> and sr.itemNo=#{itemNo} </if> <if test="status != null and status != ''"> and so.status in ${status} </if> <if test="partNo != null and partNo != ''"> and so.partNo like #{partNo} </if> <if test="planStatus != null and planStatus != ''"> and ${planStatus} </if> <if test="workCenterNo != null and workCenterNo != ''"> and sr.WorkCenterNo like #{workCenterNo} </if> </where>
order by so.NeedDate,so.EnterDate </select>
<select id="getWorkCenterOperatorList" resultType="com.srq.modules.schedule.entity.WorkCenterOperatorAndResourceData"> SELECT a.OperatorID,a.OperatorName,a.Site FROM Operator a left join operator_work_center b on a.site=b.site and a.OperatorID=b.OperatorID where b.WorkCenterNo =#{workCenterNo} and a.site=#{site} and a.active='Y' </select>
<select id="getAvailableResourceList" resultType="com.srq.modules.schedule.entity.WorkCenterOperatorAndResourceData"> SELECT site,WorkCenterNo,ResourceID,ResourceDesc FROM WorkCenterResource where WorkCenterNo =#{workCenterNo} and site=#{site} and active='Y' </select>
<select id="checkScheduleQty" resultType="ScheduleCheckData"> Select a.orderNo, a.lotSize as Qty,isnull(b.QtyScheduled,0) scheduledQty,a.lotSize -isnull(b.QtyScheduled,0) as canScheduledQty from view_ShopOrder a left join so_schedule_list b on a.site=b.site and a.orderNo=b.orderNo and b.itemNo=#{itemNo} where a.Site=#{site} and a.OrderNo=#{orderNo} </select>
<select id="checkScheduleList" resultType="ScheduleCheckData"> Select QtyScheduled from so_schedule_list where Site=#{site} and OrderNo=#{orderNo} and itemNo=#{itemNo} </select> <insert id="saveScheduleList"> insert into so_schedule_list(Site,OrderNo,ItemNo,QtyScheduled,QtyReported,PartNo,QtyApprove,TimeReported) values (#{site},#{orderNo},#{itemNo},0,0,#{partNo},0,0) </insert>
<select id="getDataSequence" resultType="integer"> select seqNo from DataSequence where SeqType= 'A' </select> <update id="updateDataSequence"> update DataSequence set seqNo=seqNo+1 where SeqType= 'A' </update>
<insert id="saveSchedule"> Insert into soscheduledrouting(Site,OrderNo,ItemNo,SeqNo,QtyRequired,QtyReported,QtyApprove,TimeRequired,TimeReported,PlanStartTime,PlanFinishTime ,BarcodeID,Remark,Crewsize,ClosedFlag,QtyScrapt,OutWorkFlag,S_ScheduledDate,S_ResourceID,S_ShiftNo,S_WorkCenterNo ,SelectedFlag,SourceFlag,ParkFlag,TimeRequired_Original,QtyRequired_Original ,StartProdFlag,CancelledProdFlag,Efficiency,EnteredDate,operatorId,partNo,operation_desc) values(#{site},#{orderNo},#{itemNo},#{seqNo},#{scheduleQty},0,0,null,0,#{scheduleDate},#{scheduleDate} ,'*','',1,'N',0,'N',#{scheduleDate},#{resourceId},#{shiftNo},#{workCenterNo} ,'N','N','N',null,null ,'N','N',#{efficiency},GETDATE(),#{operatorId},#{partNo},#{operationDesc}) </insert> <update id="updateScheduleListQty"> update so_schedule_list set QtyScheduled=QtyScheduled+#{sumQty} where Site=#{site} and OrderNo=#{orderNo} and itemNo=#{itemNo} </update>
<select id="getSOScheduleRoutingData" resultType="SOScheduledRoutingOutData"> select Site,OrderNo,ItemNo,SeqNo,QtyRequired,QtyReported,QtyApprove,TimeRequired,TimeReported, BarcodeID,Remark,Crewsize,ClosedFlag,S_ScheduledDate,S_ResourceID,S_ScheduledSeqNo,S_ShiftNo, S_WorkCenterNo, EnteredDate,operatorId,partNo,dbo.Get_PartDesc(Site,partNo) as partDesc, dbo.Get_OperatorDesc(Site,operatorId) as operatorName,dbo.Get_ItemDesc(site,OrderNo) as itemDesc, circulation_seqNo,circulation_qty from SOScheduledRouting <where> <if test="site != null and site != ''"> AND site = #{site} </if> <if test="orderNo != null and orderNo != ''"> AND OrderNo LIKE #{orderNo} </if> <if test="seqNo != null and seqNo != ''"> AND seqNo = #{seqNo} </if>
<if test="partNo != null and partNo != ''"> AND PartNo LIKE #{partNo} </if> <if test="sWorkCenterNo != null and sWorkCenterNo != ''"> AND S_WorkCenterNo LIKE #{sWorkCenterNo} </if>
<if test="itemNo != null and itemNo != ''"> and ItemNo = #{itemNo} </if>
<if test="closedFlag != null and closedFlag != ''"> and ClosedFlag = #{closedFlag} </if> <if test="startDate != null "> and S_ScheduledDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= S_ScheduledDate </if> <if test="reportFlag != null and reportFlag != ''"> and ${reportFlag} </if> <if test="operatorName != null and operatorName != ''"> and dbo.Get_OperatorDesc(Site,operatorId) like #{operatorName} </if> <if test="sResourceID != null and sResourceID != ''"> and S_ResourceID like #{sResourceID} </if> <if test="sShiftNo != null and sShiftNo != ''"> and S_ShiftNo = #{sShiftNo} </if> </where> order by S_ScheduledDate </select>
<select id="checkCloseOrOpen" resultType="SOScheduledRoutingOutData"> select Site,OrderNo,ItemNo,SeqNo,QtyRequired,QtyReported,QtyApprove,ClosedFlag,circulation_seqNo from SOScheduledRouting where seqNo=#{seqNo} AND site = #{site} and QtyRequired>QtyReported </select>
<update id="updateClosedFlag"> update SOScheduledRouting set closedFlag=#{closedFlag} where seqNo=#{seqNo} AND site = #{site} </update>
<select id="getOldSOScheduledRoutingOutData" resultType="SOScheduledRoutingOutData"> select Site,OrderNo,ItemNo,SeqNo,QtyRequired,QtyReported,QtyApprove,TimeRequired,TimeReported,PlanStartTime,PlanFinishTime, BarcodeID,Remark,Crewsize,ClosedFlag,QtyScrapt,OutWorkFlag,S_ScheduledDate,S_ResourceID,S_ScheduledSeqNo,S_ShiftNo, S_WorkCenterNo,ParkFlag,TimeRequired_Original,QtyRequired_Original,QtyReturntoSchedule,StartProdFlag,CancelledProdFlag, Efficiency,EnteredDate,SelectedFlag,SourceFlag,Closedby,ClosedDate,VirtualResourceFlag,mat_issueflag,plate_issueflag, tool_issueflag,operatorId,partNo,circulation_seqNo,circulation_qty from SOScheduledRouting where site=#{site} and seqNo=#{seqNo} </select>
<update id="closeOldSchedule"> update SOScheduledRouting set ClosedFlag='Y',circulation_seqNo=#{newSeqNo},circulation_qty=#{circulationQty} where site=#{site} and seqNo=#{oldSeqNo} </update>
<insert id="saveCirculationSchedule" > INSERT into SOScheduledRouting (Site,OrderNo,ItemNo,SeqNo,QtyRequired,QtyReported,QtyApprove,TimeRequired,TimeReported,PlanStartTime,PlanFinishTime, BarcodeID,Remark,Crewsize,ClosedFlag,QtyScrapt,OutWorkFlag,S_ScheduledDate,S_ResourceID,S_ScheduledSeqNo,S_ShiftNo, S_WorkCenterNo,ParkFlag,TimeRequired_Original,QtyRequired_Original,QtyReturntoSchedule,StartProdFlag,CancelledProdFlag, Efficiency,EnteredDate,SelectedFlag,SourceFlag,Closedby,ClosedDate,VirtualResourceFlag,mat_issueflag,plate_issueflag, tool_issueflag,operatorId,partNo) values (#{site},#{orderNo},#{itemNo},#{seqNo},#{qtyRequired},0,0,0,0,#{planStartTime},#{planFinishTime}, #{barcodeID},#{remark},#{crewsize},'N',0,'N',#{sScheduledDate},#{sResourceID},#{sScheduledSeqNo},#{sShiftNo}, #{sWorkCenterNo},#{parkFlag},#{timeRequiredOriginal},#{qtyRequiredOriginal},null,'N','N', 0,GetDate(),'N','N',NULL,NULL,NULL,'N','N','N',#{operatorId},#{partNo} ) </insert>
<select id="scanSeqNo" resultType="SOScheduledRoutingOutData"> select a.Site,a.OrderNo,a.ItemNo,a.SeqNo,a.QtyRequired,a.ClosedFlag,a.S_ScheduledDate,a.S_ScheduledSeqNo,a.S_ShiftNo,S_WorkCenterNo sWorkCenterNo, a.ParkFlag,a.operatorId ,isnull(b.partDesc,0) +'/'+ isnull(b.spec,0) as partDesc ,a.partNo,c.operatorName from SOScheduledRouting a left join view_part b on a.site=b.site and a.partNo=b.partNo left join Operator c on a.site=c.site and a.operatorId=c.operatorID where a.site=#{site} and a.seqNo=#{seqNo} </select>
<insert id="saveSfdcOperatorList"> insert into sfdc_operator_list (site,order_no,item_no,seq_no,roll_no,batch_no,defult_operator,total_operator, work_center_no,created_by,created_date,type,remark)values (#{site},#{orderNo},#{itemNo},#{seqNo},'*',#{batchNo},#{defultOperator},#{totalOperator},#{workCenterNo} ,#{createdBy},GetDate(),'派工单',#{remark}) </insert>
<insert id="saveDefectList"> insert into SFDC_DefectHist (Site,OrderNo,ItemNo,SeqNo,HistSeqNo,ReportDate,Reportedby,DefectCode,DefectQty,Remark,RollNo,DefectDesc) values(#{site},#{orderNo},#{itemNo},#{seqNo},#{histSeqNo},GetDate(),#{reportedby},#{defectCode},#{defectQty},#{remark},'*',#{defectDesc}) </insert>
<select id="getSfdcList" resultType="com.srq.modules.schedule.entity.SfdcCancel"> select a.site,a.OrderNo,a.ItemNo ,a.SeqNo,a.WorkCenterNo,a.ReportDate,a.OperatorID,a.ReportQty,a.ApproveQty,a.ReportedManfTime, a.AssJobSeqNo,a.ResourceID,a.BatchNo,b.S_ShiftNo ShiftNo,b.partNo,b.operation_desc,c.OperatorName,d.ShiftDesc,e.ResourceDesc,Reverseflag from sfdc a LEFT JOIN SOScheduledRouting b on a.Site=b.Site and a.AssJobSeqNo=b.SeqNo left join Operator c on a.site=b.site and a.OperatorID=c.OperatorID LEFT JOIN Calendar_DateType_Shift d on a.Site=d.Site and b.S_ShiftNo=d.ShiftNo left join WorkCenterResource e on a.Site=e.Site and a.ResourceID =e.ResourceID and a.WorkCenterNo=e.WorkCenterNo <where> AND a.site=#{site} <if test="orderNo != null and orderNo != ''"> and a.OrderNo like #{orderNo} </if> <if test="workCenterNo != null and workCenterNo != ''"> and a.WorkCenterNo like #{workCenterNo} </if> <if test="partNo != null and partNo != ''"> and b.partNo like #{partNo} </if> <if test="itemNo != null and itemNo != ''"> and a.ItemNo = #{itemNo} </if> <if test="operatorName != null and operatorName != ''"> and c.OperatorName like #{operatorName} </if> <if test="resourceId != null and resourceId != ''"> and a.ResourceID = #{resourceId} </if> <if test="shiftNo != null and shiftNo != ''"> and b.S_ShiftNo = #{shiftNo} </if> <if test="startDate != null "> and ReportDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= ReportDate </if> </where> order by a.ReportDate desc </select>
<select id="getSfdcOperatorList" resultType="OperatorData"> SELECT b.OperatorID,b.OperatorName FROM sfdc_operator_list a LEFT JOIN Operator b on a.site=b.Site and a.defult_operator=b.OperatorID where a.site= #{site} and a.order_no=#{orderNo} and a.item_no=#{itemNo} and a.seq_no=#{seqNo} </select>
<select id="getSfdcDefectList" resultType="com.srq.modules.base.entity.SfdcDefectHist"> select Site,OrderNo,ItemNo,SeqNo,HistSeqNo,ReportDate,Reportedby,DefectCode,DefectQty,DefectDesc from SFDC_DefectHist where site = #{site} and OrderNo=#{orderNo} and ItemNo=#{itemNo} and SeqNo=#{seqNo} </select>
<select id="checkAccessSite" resultType="com.srq.modules.base.entity.AccessSiteData"> select Site,userID from AccessSite where site=#{site} and userID=#{username} </select>
<insert id="addAccessSite"> insert into AccessSite(UserID,Site) values (#{userID},#{site}) </insert>
<select id="scheduleFormOperator" resultType="SOScheduledRoutingOutData"> select site,PartNo,partDesc,sum( QtyRequired)-sum(isnull(circulation_qty,0)) QtyRequired, sum(QtyReported) QtyReported,sum(QtyApprove) QtyApprove,operatorId,operatorName
from ( select Site,OrderNo,ItemNo,SeqNo,QtyRequired,QtyReported,QtyApprove,TimeRequired,TimeReported, BarcodeID,Remark,Crewsize,ClosedFlag,S_ScheduledDate,S_ResourceID,S_ScheduledSeqNo,S_ShiftNo, S_WorkCenterNo, EnteredDate,operatorId,partNo,dbo.Get_PartDesc(Site,partNo) as partDesc, dbo.Get_OperatorDesc(Site,operatorId) as operatorName,dbo.Get_ItemDesc(site,OrderNo) as itemDesc, circulation_seqNo,circulation_qty from SOScheduledRouting <where>
AND site = #{site}
<if test="orderNo != null and orderNo != ''"> AND OrderNo LIKE #{orderNo} </if><!-- <if test="seqNo != null and seqNo != ''">--><!-- AND seqNo = #{seqNo}--><!-- </if>-->
<if test="partNo != null and partNo != ''"> AND PartNo LIKE #{partNo} </if> <if test="sWorkCenterNo != null and sWorkCenterNo != ''"> AND S_WorkCenterNo LIKE #{sWorkCenterNo} </if>
<if test="itemNo != null and itemNo != ''"> and ItemNo = #{itemNo} </if>
<!-- <if test="closedFlag != null and closedFlag != ''">--><!-- and ClosedFlag = #{closedFlag}--><!-- </if>--> <if test="startDate != null "> and S_ScheduledDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= S_ScheduledDate </if><!-- <if test="reportFlag != null and reportFlag != ''">--><!-- and ${reportFlag}--><!-- </if>--> <if test="operatorName != null and operatorName != ''"> and dbo.Get_OperatorDesc(Site,operatorId) like #{operatorName} </if> <if test="sResourceID != null and sResourceID != ''"> and S_ResourceID like #{sResourceID} </if> <if test="sShiftNo != null and sShiftNo != ''"> and S_ShiftNo = #{sShiftNo} </if> </where> ) a
GROUP BY site,PartNo,partDesc,operatorId,operatorName order by operatorId,PartNo </select>
<select id="sfdcOperator" resultType="com.srq.modules.schedule.entity.SfdcCancel"> SELECT OperatorID ,OperatorName,partDesc,partNo,sum(ReportQty) reportQty,sum(ApproveQty) ApproveQty,sum(ReportedManfTime) ReportedManfTime from ( select c.OperatorID,c.OperatorName,dbo.Get_PartDesc(b.Site,d.partNo) partDesc, d.partNo,b.ReportQty,b.ApproveQty,b.ReportedManfTime from sfdc_operator_list a LEFT JOIN sfdc b on a.site=b.Site and a.order_no=order_no and a.item_no=b.ItemNo and a.seq_no=b.SeqNo left join Operator c on a.site=c.Site and a.defult_operator=c.OperatorID LEFT JOIN SOScheduledRouting d on b.Site=d.Site and b.AssJobSeqNo=d.SeqNo <where> AND b.site=#{site} <if test="orderNo != null and orderNo != ''"> and b.OrderNo like #{orderNo} </if> <if test="workCenterNo != null and workCenterNo != ''"> and b.WorkCenterNo like #{workCenterNo} </if> <if test="partNo != null and partNo != ''"> and d.partNo like #{partNo} </if> <if test="itemNo != null and itemNo != ''"> and b.ItemNo = #{itemNo} </if> <if test="operatorName != null and operatorName != ''"> and c.OperatorName like #{operatorName} </if> <if test="resourceId != null and resourceId != ''"> and b.ResourceID = #{resourceId} </if> <if test="shiftNo != null and shiftNo != ''"> and d.S_ShiftNo = #{shiftNo} </if> <if test="startDate != null "> and ReportDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= ReportDate </if> </where> ) d
group by OperatorID ,OperatorName,partDesc,partNo order by OperatorID,partNo </select>
<select id="sfdcResource" resultType="com.srq.modules.schedule.entity.SfdcFormData"> SELECT ResourceID ,ResourceDesc,partDesc,partNo,sum(ReportQty) reportQty,sum(ApproveQty) ApproveQty,sum(ReportedManfTime) ReportedManfTime from ( select a.ResourceID ,e.ResourceDesc ,b.partNo,dbo.Get_PartDesc(b.Site,b.partNo) partDesc,reportQty,ApproveQty,ReportedManfTime from sfdc a LEFT JOIN SOScheduledRouting b on a.Site=b.Site and a.AssJobSeqNo=b.SeqNo left join WorkCenterResource e on a.Site=e.Site and a.ResourceID =e.ResourceID and a.WorkCenterNo=e.WorkCenterNo <where> AND a.site=#{site} <if test="orderNo != null and orderNo != ''"> and a.OrderNo like #{orderNo} </if> <if test="workCenterNo != null and workCenterNo != ''"> and a.WorkCenterNo like #{workCenterNo} </if> <if test="partNo != null and partNo != ''"> and b.partNo like #{partNo} </if> <if test="itemNo != null and itemNo != ''"> and a.ItemNo = #{itemNo} </if>
<if test="resourceId != null and resourceId != ''"> and a.ResourceID = #{resourceId} </if> <if test="shiftNo != null and shiftNo != ''"> and b.S_ShiftNo = #{shiftNo} </if> <if test="startDate != null "> and ReportDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= ReportDate </if> </where> ) d group by ResourceID ,ResourceDesc,partDesc,partNo order by ResourceID ,partNo </select>
<select id="sfdcWorkCenter" resultType="com.srq.modules.schedule.entity.SfdcFormData"> SELECT WorkCenterNo,partDesc,partNo,sum(ReportQty) reportQty,sum(ApproveQty) ApproveQty,sum(ReportedManfTime) ReportedManfTime from ( select a.WorkCenterNo ,b.partNo,dbo.Get_PartDesc(b.Site,b.partNo) partDesc,reportQty,ApproveQty,ReportedManfTime from sfdc a LEFT JOIN SOScheduledRouting b on a.Site=b.Site and a.AssJobSeqNo=b.SeqNo <where> AND a.site=#{site} <if test="orderNo != null and orderNo != ''"> and a.OrderNo like #{orderNo} </if> <if test="workCenterNo != null and workCenterNo != ''"> and a.WorkCenterNo like #{workCenterNo} </if> <if test="partNo != null and partNo != ''"> and b.partNo like #{partNo} </if> <if test="itemNo != null and itemNo != ''"> and a.ItemNo = #{itemNo} </if>
<if test="resourceId != null and resourceId != ''"> and a.ResourceID = #{resourceId} </if> <if test="shiftNo != null and shiftNo != ''"> and b.S_ShiftNo = #{shiftNo} </if> <if test="startDate != null "> and b.ReportDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= b.ReportDate </if> </where> ) d group by WorkCenterNo,partDesc,partNo order by WorkCenterNo ,partNo </select>
<select id="sfdcDefectForm" resultType="com.srq.modules.schedule.entity.SfdcFormData"> select b.site,b.OrderNo,b.ItemNo ,b.SeqNo,b.WorkCenterNo,b.ReportDate,b.OperatorID,b.ReportQty,b.ApproveQty,b.ReportedManfTime, b.AssJobSeqNo,b.ResourceID,b.BatchNo,c.S_ShiftNo ShiftNo,c.partNo,c.operation_desc, dbo.Get_OperatorDesc(b.site,b.OperatorID) OperatorName,d.ShiftDesc,e.ResourceDesc,b.Reverseflag,a.DefectCode,a.DefectDesc,a.DefectQty from SFDC_DefectHist a left join sfdc b on a.site=b.Site and a.OrderNo=b.OrderNo and a.ItemNo=b.ItemNo and a.SeqNo=b.SeqNo left join SOScheduledRouting c on a.Site=c.Site and a.HistSeqNo=c.SeqNo LEFT JOIN Calendar_DateType_Shift d on a.Site=d.Site and c.S_ShiftNo=d.ShiftNo left join WorkCenterResource e on a.Site=e.Site and b.ResourceID =e.ResourceID and b.WorkCenterNo=e.WorkCenterNo <where> AND a.site=#{site} AND b.Reverseflag='N' <if test="orderNo != null and orderNo != ''"> and c.OrderNo like #{orderNo} </if> <if test="workCenterNo != null and workCenterNo != ''"> and b.WorkCenterNo like #{workCenterNo} </if> <if test="partNo != null and partNo != ''"> and c.partNo like #{partNo} </if> <if test="itemNo != null and itemNo != ''"> and a.ItemNo = #{itemNo} </if>
<if test="resourceId != null and resourceId != ''"> and b.ResourceID = #{resourceId} </if> <if test="shiftNo != null and shiftNo != ''"> and c.S_ShiftNo = #{shiftNo} </if> <if test="startDate != null "> and b.ReportDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= b.ReportDate </if> <if test="defectCode != null and defectCode != ''"> and a.defectCode like #{defectCode} </if> <if test="defectDesc != null and defectDesc != ''"> and a.defectDesc like #{defectDesc} </if>
</where> </select> <select id="sfdcDefectSummay" resultType="com.srq.modules.schedule.entity.SfdcFormData"> SELECT DefectCode,DefectDesc,sum(DefectQty) DefectQty,partNo,site,dbo.Get_PartDesc( site,partNo) partDesc from ( select b.site,b.OrderNo,b.ItemNo ,b.SeqNo,b.WorkCenterNo,b.ReportDate,b.OperatorID,b.ReportQty,b.ApproveQty,b.ReportedManfTime, b.AssJobSeqNo,b.ResourceID,b.BatchNo,c.S_ShiftNo ShiftNo,c.partNo,c.operation_desc, dbo.Get_OperatorDesc(b.site,b.OperatorID) OperatorName,d.ShiftDesc,e.ResourceDesc,b.Reverseflag,a.DefectCode,a.DefectDesc,a.DefectQty from SFDC_DefectHist a left join sfdc b on a.site=b.Site and a.OrderNo=b.OrderNo and a.ItemNo=b.ItemNo and a.SeqNo=b.SeqNo left join SOScheduledRouting c on a.Site=c.Site and a.HistSeqNo=c.SeqNo LEFT JOIN Calendar_DateType_Shift d on a.Site=d.Site and c.S_ShiftNo=d.ShiftNo left join WorkCenterResource e on a.Site=e.Site and b.ResourceID =e.ResourceID and b.WorkCenterNo=e.WorkCenterNo
<where> AND a.site=#{site} AND b.Reverseflag='N' <if test="orderNo != null and orderNo != ''"> and a.OrderNo like #{orderNo} </if> <if test="workCenterNo != null and workCenterNo != ''"> and a.WorkCenterNo like #{workCenterNo} </if> <if test="partNo != null and partNo != ''"> and b.partNo like #{partNo} </if> <if test="itemNo != null and itemNo != ''"> and a.ItemNo = #{itemNo} </if>
<if test="resourceId != null and resourceId != ''"> and a.ResourceID = #{resourceId} </if> <if test="shiftNo != null and shiftNo != ''"> and b.S_ShiftNo = #{shiftNo} </if> <if test="startDate != null "> and b.ReportDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= b.ReportDate </if> </where> ) a GROUP BY DefectCode,DefectDesc,partNo,site </select> <select id="sfdcDefectOperator" resultType="com.srq.modules.schedule.entity.SfdcFormData"> SELECT OperatorID,OperatorName,sum(DefectQty) DefectQty,partNo,site,dbo.Get_PartDesc( site,partNo) partDesc from ( select b.site,b.OrderNo,b.ItemNo ,b.SeqNo,b.WorkCenterNo,b.ReportDate,b.OperatorID,b.ReportQty,b.ApproveQty,b.ReportedManfTime, b.AssJobSeqNo,b.ResourceID,b.BatchNo,c.S_ShiftNo ShiftNo,c.partNo,c.operation_desc, dbo.Get_OperatorDesc(b.site,b.OperatorID) OperatorName,d.ShiftDesc,e.ResourceDesc,b.Reverseflag,a.DefectCode,a.DefectDesc,a.DefectQty from SFDC_DefectHist a left join sfdc b on a.site=b.Site and a.OrderNo=b.OrderNo and a.ItemNo=b.ItemNo and a.SeqNo=b.SeqNo left join SOScheduledRouting c on a.Site=c.Site and a.HistSeqNo=c.SeqNo LEFT JOIN Calendar_DateType_Shift d on a.Site=d.Site and c.S_ShiftNo=d.ShiftNo left join WorkCenterResource e on a.Site=e.Site and b.ResourceID =e.ResourceID and b.WorkCenterNo=e.WorkCenterNo
<where> AND a.site=#{site} AND b.Reverseflag='N' <if test="orderNo != null and orderNo != ''"> and a.OrderNo like #{orderNo} </if> <if test="workCenterNo != null and workCenterNo != ''"> and a.WorkCenterNo like #{workCenterNo} </if> <if test="partNo != null and partNo != ''"> and b.partNo like #{partNo} </if> <if test="itemNo != null and itemNo != ''"> and a.ItemNo = #{itemNo} </if>
<if test="resourceId != null and resourceId != ''"> and a.ResourceID = #{resourceId} </if> <if test="shiftNo != null and shiftNo != ''"> and b.S_ShiftNo = #{shiftNo} </if> <if test="startDate != null "> and b.ReportDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= b.ReportDate </if> </where> ) a GROUP BY OperatorID,OperatorName,partNo,site </select> <select id="sfdcDefectResource" resultType="com.srq.modules.schedule.entity.SfdcFormData"> SELECT ResourceID,ResourceDesc,sum(DefectQty) DefectQty,partNo,site,dbo.Get_PartDesc( site,partNo) partDesc from ( select b.site,b.OrderNo,b.ItemNo ,b.SeqNo,b.WorkCenterNo,b.ReportDate,b.OperatorID,b.ReportQty,b.ApproveQty,b.ReportedManfTime, b.AssJobSeqNo,b.ResourceID,b.BatchNo,c.S_ShiftNo ShiftNo,c.partNo,c.operation_desc, dbo.Get_OperatorDesc(b.site,b.OperatorID) OperatorName,d.ShiftDesc,e.ResourceDesc,b.Reverseflag,a.DefectCode,a.DefectDesc,a.DefectQty from SFDC_DefectHist a left join sfdc b on a.site=b.Site and a.OrderNo=b.OrderNo and a.ItemNo=b.ItemNo and a.SeqNo=b.SeqNo left join SOScheduledRouting c on a.Site=c.Site and a.HistSeqNo=c.SeqNo LEFT JOIN Calendar_DateType_Shift d on a.Site=d.Site and c.S_ShiftNo=d.ShiftNo left join WorkCenterResource e on a.Site=e.Site and b.ResourceID =e.ResourceID and b.WorkCenterNo=e.WorkCenterNo
<where> AND a.site=#{site} AND b.Reverseflag='N' <if test="orderNo != null and orderNo != ''"> and a.OrderNo like #{orderNo} </if> <if test="workCenterNo != null and workCenterNo != ''"> and a.WorkCenterNo like #{workCenterNo} </if> <if test="partNo != null and partNo != ''"> and b.partNo like #{partNo} </if> <if test="itemNo != null and itemNo != ''"> and a.ItemNo = #{itemNo} </if>
<if test="resourceId != null and resourceId != ''"> and a.ResourceID = #{resourceId} </if> <if test="shiftNo != null and shiftNo != ''"> and b.S_ShiftNo = #{shiftNo} </if> <if test="startDate != null "> and b.ReportDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= b.ReportDate </if> </where> ) a GROUP BY ResourceID,ResourceDesc,partNo,site </select> <select id="sfdcDefectWorkCenter" resultType="com.srq.modules.schedule.entity.SfdcFormData"> SELECT WorkCenterNo,sum(DefectQty) DefectQty,partNo,site,dbo.Get_PartDesc( site,partNo) partDesc from ( select b.site,b.OrderNo,b.ItemNo ,b.SeqNo,b.WorkCenterNo,b.ReportDate,b.OperatorID,b.ReportQty,b.ApproveQty,b.ReportedManfTime, b.AssJobSeqNo,b.ResourceID,b.BatchNo,c.S_ShiftNo ShiftNo,c.partNo,c.operation_desc, dbo.Get_OperatorDesc(b.site,b.OperatorID) OperatorName,d.ShiftDesc,e.ResourceDesc,b.Reverseflag,a.DefectCode,a.DefectDesc,a.DefectQty from SFDC_DefectHist a left join sfdc b on a.site=b.Site and a.OrderNo=b.OrderNo and a.ItemNo=b.ItemNo and a.SeqNo=b.SeqNo left join SOScheduledRouting c on a.Site=c.Site and a.HistSeqNo=c.SeqNo LEFT JOIN Calendar_DateType_Shift d on a.Site=d.Site and c.S_ShiftNo=d.ShiftNo left join WorkCenterResource e on a.Site=e.Site and b.ResourceID =e.ResourceID and b.WorkCenterNo=e.WorkCenterNo
<where> AND a.site=#{site} AND b.Reverseflag='N' <if test="orderNo != null and orderNo != ''"> and a.OrderNo like #{orderNo} </if> <if test="workCenterNo != null and workCenterNo != ''"> and a.WorkCenterNo like #{workCenterNo} </if> <if test="partNo != null and partNo != ''"> and b.partNo like #{partNo} </if> <if test="itemNo != null and itemNo != ''"> and a.ItemNo = #{itemNo} </if>
<if test="resourceId != null and resourceId != ''"> and a.ResourceID = #{resourceId} </if> <if test="shiftNo != null and shiftNo != ''"> and b.S_ShiftNo = #{shiftNo} </if> <if test="startDate != null "> and b.ReportDate >= #{startDate} </if> <if test="endDate != null "> and #{endDate} >= b.ReportDate </if> </where> ) a GROUP BY WorkCenterNo,partNo,site </select></mapper>
|