You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1039 lines
58 KiB
1039 lines
58 KiB
<?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.heai.modules.production.dao.DailyPlanMapper">
|
|
|
|
|
|
|
|
|
|
<select id="getShopOrderData" resultType="com.heai.modules.production.entity.ShopOrderData" parameterType="com.heai.modules.production.entity.DailyPlanInData">
|
|
select a.site, a.OrderNo,a.PartNo,a.Status,a.PlanStartDate,a.NeedDate,a.LotSize,a.EnterDate,a.UserName,
|
|
P.Spec+'/'+isnull(P.PartDescription,'') PartDescription,P.Spec,ROUND(ISNULL(so.scheduling_size,0),3) as scheduling_size,dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderNo) as weightFactor,
|
|
Round(dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderNo)*a.LotSize,2) as weight
|
|
FROM ShopOrder a
|
|
LEFT JOIN Part P ON P.PartNo=a.PartNo AND a.site=P.Site
|
|
LEFT JOIN so_scheduled_list so ON a.site=so.Site AND a.OrderNo= so.order_no
|
|
<where>
|
|
<if test="site != null and site != ''">
|
|
AND a.site = #{site}
|
|
</if>
|
|
<if test="partDescription != null and partDescription != ''">
|
|
AND P.Spec+'/'+isnull(P.PartDescription,'') like #{partDescription}
|
|
</if>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
AND a.OrderNo LIKE #{orderNo}
|
|
</if>
|
|
<if test="status !=null and status != ''">
|
|
AND a.Status IN ${status}
|
|
</if>
|
|
<if test="startDate1 != null ">
|
|
AND a.EnterDate >= #{startDate1}
|
|
</if>
|
|
<if test="endDate1 != null ">
|
|
AND #{endDate1} >= DATEADD(dd, -1, a.EnterDate)
|
|
</if>
|
|
<if test="startDate2 != null ">
|
|
AND a.PlanStartDate >= #{startDate2}
|
|
</if>
|
|
<if test="endDate2 != null ">
|
|
AND #{endDate2} >= a.PlanStartDate
|
|
</if>
|
|
<if test="startDate3 != null ">
|
|
AND a.NeedDate >= #{startDate3}
|
|
</if>
|
|
<if test="endDate3 != null ">
|
|
AND #{endDate3} >= a.NeedDate
|
|
</if>
|
|
<if test="partNo != null and partNo != ''">
|
|
AND a.PartNo LIKE #{partNo}
|
|
</if>
|
|
<if test="planStatus != null and planStatus != ''">
|
|
and ${planStatus}
|
|
</if>
|
|
AND a.PartNo like 'SP%'
|
|
</where>
|
|
order by a.PlanStartDate
|
|
</select>
|
|
|
|
<select id="getGenerateReportList" resultType="com.heai.modules.production.entity.GenerateReportData">
|
|
Select T.Site,T.OrderNo,T.ItemNo,T.OperationDesc,T.WorkCenterNo,W.WorkCenterDesc,T.QtyRequired,T.QtyReported
|
|
,T.QtyApprove ,T.TimeRequired,T.TimeReported,T.PlanStartTime,T.PlanFinishTime
|
|
,T.ClosedFlag,T.PartNo,P.PartDescription,P.Spec,D.NeedDate,D.PlanStartDate,D.Status
|
|
,D.LotSize,D.FinishedQty
|
|
from SORouting as T,ShopOrder as D,WorkCenter as W,Part as P
|
|
<where>
|
|
T.Site=D.Site and T.OrderNo=D.OrderNo and T.Site=W.Site and T.WorkCenterNo=W.WorkCenterNo
|
|
and D.Site=P.Site and D.PartNo=P.PartNo
|
|
<if test="site != null and site != ''">
|
|
and T.site = #{site,jdbcType=VARCHAR}
|
|
</if>
|
|
<if test="workCenterNo != null and workCenterNo != ''">
|
|
and T.WorkCenterNo like '%' + #{workCenterNo,jdbcType=VARCHAR} + '%'
|
|
</if>
|
|
<if test="partNo != null and partNo != ''">
|
|
and T.PartNo like '%' + #{partNo,jdbcType=VARCHAR} + '%'
|
|
</if>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
and T.OrderNo like '%' + #{orderNo,jdbcType=VARCHAR} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getShopOrderForHunlian" resultType="com.heai.modules.production.entity.ShopOrderData">
|
|
select A.OrderNo ,A.Site ,A.EnterDate ,A.UserName ,A.NeedDate ,A.OriginalNeedDate ,A.PlanStartDate ,A.ReleaseDate
|
|
,A.ReleaseGuys ,A.ScheduleDate ,A.Scheduler ,A.IssueDate ,A.ReportDate ,A.ReceiveDate ,A.CloseDate
|
|
,A.Planner ,A.Status ,A.Status_Tmp ,A.Printed ,A.OrderType ,A.PartNo ,A.LotSize ,A.FinishedQty
|
|
,A.ProjectID ,A.BOMRevNo ,A.RoutingRevNo ,A.Leadtime ,A.Remark ,A.OrderRef1 ,A.OrderRef2 ,A.CostRollUpFlag
|
|
,A.ManualFlag ,A.OriSOOrderNo ,A.CustomerID ,A.TechInfo ,A.ReceiveStatus ,A.E_OriginalOrderNo
|
|
,A.E_Levels ,A.E_OriginalOrderType ,A.E_SeqNo ,A.E_LevelCode ,A.SFDCReportedFlag ,A.RepairSOFlag
|
|
,A.ConfigurationFlag ,A.MaterialSplitFlag ,A.ObjectVersion ,A.ExpandFlag ,A.CodeNo ,A.LE_SeqNo
|
|
,A.LE_ItemNo ,A.LE_Levels
|
|
,B.PartDescription,dbo.Get_PartWeightFactorForReport(A.Site ,A.PartNo,A.OrderNo) as weightFactor,
|
|
Round(dbo.Get_PartWeightFactorForReport(A.Site ,A.PartNo,A.OrderNo)*A.LotSize,2) weight
|
|
from ShopOrder A
|
|
left join Part B on A.site = B.site and A.PartNo = B.PartNo
|
|
<where>
|
|
and (a.PartNo like 'RC%' or a.PartNo like 'SC%')
|
|
<if test="site != null and site != ''">
|
|
and A.Site = #{site,jdbcType=VARCHAR}
|
|
</if>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
and A.OrderNo = #{orderNo,jdbcType=VARCHAR}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getHunlianTaskHeader" resultType="com.heai.modules.production.entity.HunlianData">
|
|
select Site,TaskNo,orderRef1 from Hunlian_TaskHeader where DeleteFlag='N' and TaskNo=#{taskNo}
|
|
</select>
|
|
|
|
<select id="getShopOrderList" resultType="com.heai.modules.production.entity.ShopOrderData">
|
|
select A.OrderNo ,A.Site ,A.EnterDate ,A.UserName ,A.NeedDate ,A.OriginalNeedDate ,A.PlanStartDate ,A.ReleaseDate
|
|
,A.ReleaseGuys ,A.ScheduleDate ,A.Scheduler ,A.IssueDate ,A.ReportDate ,A.ReceiveDate ,A.CloseDate
|
|
,A.Planner ,A.Status ,A.Status_Tmp ,A.Printed ,A.OrderType ,A.PartNo ,A.LotSize ,A.FinishedQty
|
|
,A.ProjectID ,A.BOMRevNo ,A.RoutingRevNo ,A.Leadtime ,A.Remark ,A.OrderRef1 ,A.OrderRef2 ,A.CostRollUpFlag
|
|
,A.ManualFlag ,A.OriSOOrderNo ,A.CustomerID ,A.TechInfo ,A.ReceiveStatus ,A.E_OriginalOrderNo
|
|
,A.E_Levels ,A.E_OriginalOrderType ,A.E_SeqNo ,A.E_LevelCode ,A.SFDCReportedFlag ,A.RepairSOFlag
|
|
,A.ConfigurationFlag ,A.MaterialSplitFlag ,A.ObjectVersion ,A.ExpandFlag ,A.CodeNo ,A.LE_SeqNo
|
|
,A.LE_ItemNo ,A.LE_Levels
|
|
,B.PartDescription
|
|
from ShopOrder A
|
|
left join Part B on A.site = B.site and A.PartNo = B.PartNo
|
|
<where>
|
|
<if test="site != null and site != ''">
|
|
and A.Site = #{site,jdbcType=VARCHAR}
|
|
</if>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
and A.OrderNo = #{orderNo,jdbcType=VARCHAR}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="getTransfer" resultType="com.heai.modules.production.entity.ShopOrderData">
|
|
select a.TransNo as transFerNo ,b.PartNo,c.PartDescription,a.Status,b.TransQty as lotSize,b.ConfirmQty as FinishedQty,a.Site, b.OrderNo,dbo.Get_PartWeightFactorForReport(A.Site ,b.PartNo,b.OrderNo) as weightFactor,
|
|
dbo.Get_Part_DefaultWarehouseID(a.Site,b.PartNo) DefaultWarehouseID,b.seqNo,a.needReceiveFlag,Round(isnull(b.boxWeight,0),2) boxWeight
|
|
from SOOpsTransferHeader a left join SOOpsTransferDetail b on a.TransNo=b.TransNo and a.Site=b.Site
|
|
LEFT JOIN Part c on b.partNo=c.partNo and c.site=a.site
|
|
<where>
|
|
|
|
<if test="transFerNo != null and transFerNo != ''">
|
|
and a.TransNo = #{transFerNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="checkShopOrderStatus" resultType="com.heai.modules.production.entity.ShopOrderData">
|
|
select orderNo,status from shopOrder where Site=#{site} and OrderNo=#{orderNo}
|
|
</select>
|
|
<select id="getOperatorData" resultType="com.heai.modules.production.entity.OperatorData" >
|
|
select Site,OperatorID,OperatorName,Active,Department,CreatedDate,Passwords,LineLeader,tv_id
|
|
from Operator
|
|
<where>
|
|
<if test="site != null and site != ''">
|
|
and Site = #{site}
|
|
</if>
|
|
<if test="operatorID != null and operatorID != ''">
|
|
and OperatorID like #{operatorID,jdbcType=VARCHAR}
|
|
</if>
|
|
<if test="operatorName != null and operatorName != ''">
|
|
and OperatorName like #{operatorName}
|
|
</if>
|
|
<if test="active != null and active != ''">
|
|
and Active = #{active}
|
|
</if>
|
|
<if test="department != null and department != '' and department != 'all'">
|
|
and department = #{department}
|
|
</if>
|
|
</where>
|
|
order by CreatedDate
|
|
</select>
|
|
|
|
<select id="getWorkCenterData" resultType="WorkCenterData">
|
|
select a.Site,a.WorkCenterNo,a.WorkCenterDesc,a.Active FROM WorkCenter a left join
|
|
operator_work_center b on a.Site=b.Site and a.WorkCenterNo=b.WorkCenterNo and b.OperatorID=#{operatorID}
|
|
where a.site=#{site} and b.WorkCenterNo is null
|
|
order by a.WorkCenterNo
|
|
</select>
|
|
<select id="getWorkCenterOperatorData" resultType="WorkCenterData">
|
|
select a.Site,a.WorkCenterNo,b.WorkCenterDesc,b.Active FROM operator_work_center a left join
|
|
WorkCenter b on a.Site=b.Site and a.WorkCenterNo=b.WorkCenterNo
|
|
where a.site=#{site} and a.OperatorID=#{operatorID}
|
|
order by a.WorkCenterNo
|
|
</select>
|
|
|
|
<insert id="addSkill">
|
|
insert into operator_work_center(OperatorID,WorkCenterNo,created_by,created_date,Site)
|
|
values(#{operatorID},#{workCenterNo},#{user},GetDate(),#{site})
|
|
</insert>
|
|
|
|
<delete id="deleteSkill">
|
|
delete from operator_work_center where OperatorID=#{operatorID} and Site=#{site} and WorkCenterNo=#{workCenterNo}
|
|
</delete>
|
|
<insert id="addUserSkill">
|
|
insert into user_work_center(UserId,WorkCenterNo,created_by,created_date,Site)
|
|
values(#{userId},#{workCenterNo},#{user},GetDate(),#{site})
|
|
</insert>
|
|
|
|
<insert id="addUserSkillAll">
|
|
insert into user_work_center(UserId,WorkCenterNo,created_by,created_date,Site)
|
|
SELECT #{userId} ,a.WorkCenterNo ,#{user},GETDATE(), a.site FROM WorkCenter a
|
|
left join user_work_center b on a.site=b.site and a.WorkCenterNo=b.WorkCenterNo and b.UserId= #{userId}
|
|
where b.Site is null
|
|
</insert>
|
|
|
|
<delete id="deleteUserSkill">
|
|
delete from user_work_center where UserId=#{userId} and Site=#{site} and WorkCenterNo=#{workCenterNo}
|
|
</delete>
|
|
|
|
<delete id="deleteUserSkillAll">
|
|
delete from user_work_center where UserId=#{userId}
|
|
</delete>
|
|
<select id="checkWorkCenterOperatorData" resultType="WorkCenterData">
|
|
select site FROM operator_work_center where OperatorID=#{operatorID} and Site=#{site} and WorkCenterNo=#{workCenterNo}
|
|
</select>
|
|
|
|
<select id="checkUserOperatorData" resultType="WorkCenterData">
|
|
select site FROM user_work_center where userId=#{userId} and Site=#{site} and WorkCenterNo=#{workCenterNo}
|
|
</select>
|
|
<select id="getAllWorkCenterDataForUser" resultType="WorkCenterData">
|
|
select a.Site,a.WorkCenterNo,a.WorkCenterDesc,a.Active FROM WorkCenter a left join
|
|
user_work_center b on a.Site=b.Site and a.WorkCenterNo=b.WorkCenterNo and b.userId=#{user}
|
|
where b.WorkCenterNo is null
|
|
order by a.WorkCenterNo ,a.site
|
|
</select>
|
|
<select id="getWorkCenterUserData" resultType="WorkCenterData">
|
|
select a.Site,a.WorkCenterNo,b.WorkCenterDesc,b.Active FROM user_work_center a left join
|
|
WorkCenter b on a.Site=b.Site and a.WorkCenterNo=b.WorkCenterNo
|
|
where a.userId=#{user}
|
|
order by a.WorkCenterNo,a.site
|
|
</select>
|
|
<select id="getShopOrderRoutingData" resultType="ShopOrderRoutingData">
|
|
select a.site, a.OrderNo,a.PartNo,a.Status,a.PlanStartDate,a.NeedDate,a.LotSize,a.EnterDate,a.UserName,
|
|
P.Spec+'/'+isnull(P.PartDescription,'') PartDescription,P.Spec,isnull(SL.scheduledQty,0) as scheduledQty,s.workCenterNo,S.qtyReported,S.qtyApprove,S.machSetupTime,
|
|
S.machRunFactor,S.factorUnit,S.ItemNo,S.OperationDesc,s.Efficiency,isnull(SOP.TotalFinishedQty,0) lastApproveQty,dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderNo) weightFactor,
|
|
Round(dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderNo)*a.LotSize,2) weight,dbo.Get_PartPlanQty(a.site,a.PartNo,a.OrderNo) partPlanQty,cod.PlanShipDate,
|
|
dbo.Get_LastStartTime( a.site, a.OrderNo,S.ItemNo) LastStartDate,Round(S.DefectiveQty,3) DefectiveQty
|
|
FROM ShopOrder a
|
|
LEFT JOIN Part P ON P.PartNo=a.PartNo AND a.site=P.Site
|
|
LEFT JOIN SORouting S on S.site=a.site and S.OrderNo=a.orderNo
|
|
LEFT JOIN ScheduleList SL on S.site=SL.site and S.OrderNo=SL.orderNo and S.ItemNo=SL.ItemNo
|
|
LEFT JOIN SORoutingOutput SOP ON a.site=SOP.site and a.OrderNo=SOP.OrderNo and SOP.itemNo=dbo.Get_SORouting_PreviousOperationItemNo(a.site,a.OrderNo,S.itemNo)
|
|
left join user_work_center uwc on a.site=uwc.site and s.workCenterNo =uwc.WorkCenterNo and uwc.userId=#{userId}
|
|
left join CODetail cod on a.site=cod.site and a.orderRef1=cod.OrderNo and a.orderRef2= CONVERT(VARCHAR(10),cod.ItemNo)
|
|
<where>
|
|
and uwc.WorkCenterNo is not null
|
|
and a.PartNo NOT like 'SP%' and a.PartNo NOT like 'RC%' and a.PartNo NOT like 'SC%'
|
|
<if test="site != null and site != ''">
|
|
AND a.site = #{site}
|
|
</if>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
AND a.OrderNo LIKE #{orderNo}
|
|
</if>
|
|
and a.status in ('已下达','已发料','已入库','已开工','已排产')
|
|
<if test="startDate1 != null ">
|
|
AND a.EnterDate >= #{startDate1}
|
|
</if>
|
|
<if test="endDate1 != null ">
|
|
AND #{endDate1} >= DATEADD(dd, -1, a.EnterDate)
|
|
</if>
|
|
<if test="startDate2 != null ">
|
|
AND a.PlanStartDate >= #{startDate2}
|
|
</if>
|
|
<if test="endDate2 != null ">
|
|
AND #{endDate2} >= a.PlanStartDate
|
|
</if>
|
|
<if test="startDate3 != null ">
|
|
AND a.NeedDate >= #{startDate3}
|
|
</if>
|
|
<if test="endDate3 != null ">
|
|
AND #{endDate3} >= a.NeedDate
|
|
</if>
|
|
<if test="startDate4 != null ">
|
|
AND cod.PlanShipDate >= #{startDate4}
|
|
</if>
|
|
<if test="endDate4 != null ">
|
|
AND #{endDate4} >= cod.PlanShipDate
|
|
</if>
|
|
<if test="partNo != null and partNo != ''">
|
|
AND a.PartNo LIKE #{partNo}
|
|
</if>
|
|
<if test="planStatus != null and planStatus != ''">
|
|
and ${planStatus}
|
|
</if>
|
|
<if test="itemNo != null and itemNo != ''">
|
|
and S.ItemNo = #{itemNo}
|
|
</if>
|
|
<if test="partDescription != null and partDescription != ''">
|
|
and P.Spec+'/'+isnull(P.PartDescription,'') like #{partDescription}
|
|
</if>
|
|
<if test="eLevels != null ">
|
|
and a.E_Levels = #{eLevels}
|
|
</if>
|
|
</where>
|
|
order by a.PlanStartDate desc,s.itemNo
|
|
</select>
|
|
|
|
<update id="updateSOTaskCombineTime">
|
|
update SOTaskOrderHeader set CombineTime = GetDate() where site=#{site} and orderNo=#{orderNo}
|
|
</update>
|
|
|
|
<select id="getSOTastRoutingData" resultType="ShopOrderRoutingData">
|
|
select a.site, a.OrderNo,a.PartNo,a.Status,a.OrderRef1,a.OrderDate,a.OrderQty as LotSize,dbo.Get_PartValue(a.site,a.PartNo,'equipment') as equipment,
|
|
P.Spec+'/'+isnull(P.PartDescription,'') PartDescription,P.Spec,isnull(SL.scheduledQty,0) as scheduledQty,s.workCenterNo,S.machSetupTime,
|
|
S.machRunFactor,S.factorUnit,S.ItemNo,S.OperationDesc,s.Efficiency,a.qtyfinished,a.finishFlag,ROUND(dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderRef1)*a.OrderQty,2) as weight,
|
|
dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderRef1) as weightFactor,dbo.Get_PartPlanQty(a.site,a.PartNo,a.OrderRef1) partPlanQty,so.needDate,cod.PlanShipDate
|
|
,a.comBineTime lastStartDate
|
|
FROM SOTaskOrderHeader a
|
|
LEFT JOIN Part P ON P.PartNo=a.PartNo AND a.site=P.Site
|
|
LEFT JOIN SORouting S on S.site=a.site and S.OrderNo=a.OrderRef1
|
|
LEFT JOIN ScheduleList SL on S.site=SL.site and a.OrderNo=SL.orderNo and S.ItemNo=SL.ItemNo
|
|
left join user_work_center uwc on a.site=uwc.site and s.workCenterNo =uwc.WorkCenterNo and uwc.userId=#{userId}
|
|
LEFT JOIN ShopOrder so on a.OrderRef1=so.OrderNo and a.site=so.site
|
|
left join CODetail cod on so.site=cod.site and so.orderRef1=cod.OrderNo and so.orderRef2= CONVERT(VARCHAR(10),cod.ItemNo)
|
|
<where>
|
|
and uwc.WorkCenterNo is not null
|
|
and so.status not in ('已关闭','已计划','已取消')
|
|
<if test="site != null and site != ''">
|
|
AND a.site = #{site}
|
|
</if>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
AND a.OrderNo LIKE #{orderNo}
|
|
</if>
|
|
<if test="status !=null and status != ''">
|
|
AND a.Status IN ${status}
|
|
</if>
|
|
<if test="startDate1 != null ">
|
|
AND a.orderDate >= #{startDate1}
|
|
</if>
|
|
<if test="endDate1 != null ">
|
|
AND #{endDate1} >= a.orderDate
|
|
</if>
|
|
<if test="partDescription != null and partDescription != ''">
|
|
and P.Spec+'/'+isnull(P.PartDescription,'') like #{partDescription}
|
|
</if>
|
|
<if test="orderRef1 != null and orderRef1 != ''">
|
|
AND a.OrderRef1 LIKE #{orderRef1}
|
|
</if>
|
|
<if test="partNo != null and partNo != ''">
|
|
AND a.PartNo LIKE #{partNo}
|
|
</if>
|
|
<if test="planStatus != null and planStatus != ''">
|
|
and ${planStatus}
|
|
</if>
|
|
<if test="itemNo != null and itemNo != ''">
|
|
and S.ItemNo = #{itemNo}
|
|
</if>
|
|
<if test="finishFlag != null and finishFlag != ''">
|
|
AND a.FinishFlag=#{finishFlag}
|
|
</if>
|
|
<if test="startDate3 != null ">
|
|
AND so.NeedDate >= #{startDate3}
|
|
</if>
|
|
<if test="endDate3 != null ">
|
|
AND #{endDate3} >= so.NeedDate
|
|
</if>
|
|
<if test="startDate4 != null ">
|
|
AND cod.PlanShipDate >= #{startDate4}
|
|
</if>
|
|
<if test="endDate4 != null ">
|
|
AND #{endDate4} >= cod.PlanShipDate
|
|
</if>
|
|
</where>
|
|
order by a.OrderDate desc,s.itemNo
|
|
</select>
|
|
|
|
<select id="getWorkCenterOperatorList" resultType="OperatorData">
|
|
Select a.OperatorID,a.OperatorName from Operator a left join operator_work_center b on a.site=b.site and a.OperatorID=b.OperatorID
|
|
where a.site=#{site} and b.WorkCenterNo=#{workCenterNo} and a.Active='Y'
|
|
</select>
|
|
|
|
<select id="checkScheduleQty" resultType="ScheduleCheckData">
|
|
Select a.lotSize as Qty,isnull(b.scheduledQty,0) scheduledQty from ShopOrder a left join ScheduleList 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="checkScheduleQtyForSoTask" resultType="ScheduleCheckData">
|
|
Select a.OrderQty as Qty,isnull(b.scheduledQty,0) scheduledQty from SOTaskOrderHeader a left join ScheduleList 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 Qty from ScheduleList where Site=#{site} and OrderNo=#{orderNo} and itemNo=#{itemNo}
|
|
</select>
|
|
|
|
<insert id="saveScheduleList">
|
|
insert into ScheduleList(Site,OrderNo,ItemNo,Type,Type_db,Qty,scheduledQty) values (#{site},#{orderNo},#{itemNo},'生产订单派工单','S',#{qty},0)
|
|
</insert>
|
|
<insert id="saveScheduleListForSOTask">
|
|
insert into ScheduleList(Site,OrderNo,ItemNo,Type,Type_db,Qty,scheduledQty) values (#{site},#{orderNo},#{itemNo},'日计划派工单','D',#{qty},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,scheduleType,operatorId,partNo,OrderRef1,cancelReportFlag,CreateBy,WorkTime,stopTime,jobType)
|
|
values(#{site},#{orderNo},#{itemNo},#{seqNo},#{scheduleQty},0,0,dbo.Get_SOScheduleRouting_TimeRequired(#{site},#{orderNo},#{itemNo},#{scheduleQty}),0,#{scheduleDate},#{scheduleDate}
|
|
,'*',#{remark},1,'N',0,'Y',#{scheduleDate},#{resourceId},#{shiftNo},#{workCenterNo}
|
|
,'N','N','N',dbo.Get_SOScheduleRouting_TimeRequired(#{site},#{orderNo},#{itemNo},#{scheduleQty}),#{scheduleQty}
|
|
,'N','N',#{efficiency},GETDATE(),'生产订单派工单',#{operatorId},#{partNo},#{orderNo},'N',#{createBy},0,0,#{jobType})
|
|
</insert>
|
|
<insert id="saveScheduleForSOTask">
|
|
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,scheduleType,operatorId,partNo,OrderRef1,cancelReportFlag,CreateBy,WorkTime,stopTime,jobType)
|
|
values(#{site},#{orderRef1},#{itemNo},#{seqNo},#{scheduleQty},0,0,dbo.Get_SOScheduleRouting_TimeRequired(#{site},#{orderRef1},#{itemNo},#{scheduleQty}),0,#{scheduleDate},#{scheduleDate}
|
|
,'*',#{remark},1,'N',0,'Y',#{scheduleDate},#{resourceId},#{shiftNo},#{workCenterNo}
|
|
,'N','N','N',dbo.Get_SOScheduleRouting_TimeRequired(#{site},#{orderRef1},#{itemNo},#{scheduleQty}),#{scheduleQty}
|
|
,'N','N',#{efficiency},GETDATE(),'日计划派工单',#{operatorId},#{partNo},#{orderNo},'N',#{createBy},0,0,#{jobType})
|
|
</insert>
|
|
|
|
<update id="updateScheduleListQty">
|
|
update ScheduleList set scheduledQty=scheduledQty+#{sumQty} where Site=#{site} and OrderNo=#{orderNo} and itemNo=#{itemNo} and type=#{scheduleType}
|
|
</update>
|
|
<select id="searchReportedQty" resultType="SORoutingData">
|
|
select top 1 isnull(a.QtyReported,0) QtyReported,isnull(SOP.TotalFinishedQty,0) lastApproveQty ,dbo.Get_PartWeightFactorForReport(#{site},#{partNo},#{orderNo}) as weightFactor,dbo.Get_sfdcReportedSetupTime(#{site},#{seqNo}) as timeReported,
|
|
[dbo].[Get_Part_Cavity](#{site},#{partNo},#{orderNo}) as cavity
|
|
from SORouting a
|
|
LEFT JOIN SORoutingOutput SOP ON a.site=SOP.site and a.OrderNo=SOP.OrderNo and SOP.itemNo=dbo.Get_SORouting_PreviousOperationItemNo(a.site,a.OrderNo,a.itemNo)
|
|
where a.Site=#{site} and a.OrderNo=#{orderNo} and a.itemNo=#{itemNo}
|
|
</select>
|
|
|
|
<select id="getSPBomQtyAssembly" resultType="com.heai.modules.app.entity.SoBomData">
|
|
select QtyAssembly from SOBOM where site=#{site} and OrderNo=#{orderNo} and ComponentPartNo like 'SP%'
|
|
</select>
|
|
<select id="searchLastApproveQty" resultType="SORoutingData">
|
|
select top 1 isnull(TotalFinishedQty,0) lastApproveQty from SORoutingOutput where Site=#{site} and OrderNo=#{orderNo} and itemNo=dbo.Get_SORouting_PreviousOperationItemNo(#{site},#{orderNo},#{itemNo})
|
|
</select>
|
|
<select id="getSOScheduleRoutingDataForShiyanshi" resultType="SOScheduledRoutingOutData">
|
|
select a.Site,OrderNo,ItemNo,SeqNo,QtyRequired,QtyReported,QtyApprove,TimeRequired,TimeReported,
|
|
BarcodeID,Remark,Crewsize,ClosedFlag,S_ScheduledDate,S_ResourceID,S_ScheduledSeqNo,S_ShiftNo,
|
|
S_WorkCenterNo, EnteredDate,scheduleType,operatorId,partNo,dbo.Get_Part_SpecDesc(a.Site,partNo) as partDesc,
|
|
dbo.Get_OperatorDesc(a.Site,operatorId) as operatorName,dbo.Get_ItemDesc(a.Site,OrderNo,ItemNo) as itemDesc,orderRef1 ,
|
|
dbo.Get_WorkCenterDesc(a.Site,S_WorkCenterNo) as workCenterDesc , dbo.Get_Part_SpecDesc(a.Site,partNo) as partSpec,circulation_seqNo,circulation_qty
|
|
,dbo.Get_PartWeightFactorForReport(a.site,PartNo,OrderNo) as weightFactor,dbo.Get_Part_UMID(a.Site,PartNo) umid,
|
|
Round(dbo.Get_PartWeightFactorForReport(a.site,PartNo,OrderNo)*QtyRequired,2) as weight from SOScheduledRouting a
|
|
|
|
<where>
|
|
|
|
<if test="seqNo != null and seqNo != ''">
|
|
AND a.seqNo = #{seqNo}
|
|
</if>
|
|
<if test="site != null and site != ''">
|
|
AND a.site = #{site}
|
|
</if>
|
|
</where>
|
|
order by S_ScheduledDate
|
|
</select>
|
|
|
|
<select id="getSOScheduleRoutingData" resultType="SOScheduledRoutingOutData">
|
|
select a.Site,OrderNo,ItemNo,SeqNo,QtyRequired,QtyReported,QtyApprove,TimeRequired,TimeReported,previousSeqNo,previousBatchNo,materSeqNo,
|
|
BarcodeID,Remark,Crewsize,ClosedFlag,S_ScheduledDate,S_ResourceID,S_ScheduledSeqNo,S_ShiftNo,
|
|
S_WorkCenterNo, EnteredDate,scheduleType,operatorId,partNo,dbo.Get_Part_SpecDesc(a.Site,partNo) as partDesc,
|
|
dbo.Get_OperatorDesc(a.Site,operatorId) as operatorName,dbo.Get_ItemDesc(a.Site,OrderNo,ItemNo) as itemDesc,orderRef1 ,
|
|
dbo.Get_WorkCenterDesc(a.Site,S_WorkCenterNo) as workCenterDesc , dbo.Get_Part_SpecDesc(a.Site,partNo) as partSpec,circulation_seqNo,circulation_qty
|
|
,dbo.Get_PartWeightFactorForReport(a.site,PartNo,OrderNo) as weightFactor,dbo.Get_Part_UMID(a.Site,PartNo) umid,a.jobType,
|
|
Round(dbo.Get_PartWeightFactorForReport(a.site,PartNo,OrderNo)*QtyRequired,2) as weight from SOScheduledRouting a
|
|
left join user_work_center uwc on a.site=uwc.site and a.S_WorkCenterNo =uwc.WorkCenterNo and uwc.userId=#{userId}
|
|
<where>
|
|
and uwc.WorkCenterNo is not null
|
|
|
|
<if test="site != null and site != ''">
|
|
AND a.site = #{site}
|
|
</if>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
AND OrderNo LIKE #{orderNo}
|
|
</if>
|
|
<if test="partDesc != null and partDesc != ''">
|
|
AND dbo.Get_Part_SpecDesc(a.Site,partNo) LIKE #{partDesc}
|
|
</if>
|
|
<if test="seqNo != null ">
|
|
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="itemDesc != null and itemDesc != ''">
|
|
and dbo.Get_ItemDesc(a.Site,OrderNo,ItemNo) = #{itemDesc}
|
|
</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="scheduleType != null and scheduleType != ''">
|
|
and scheduleType = #{scheduleType}
|
|
</if>
|
|
<if test="reportFlag != null and reportFlag != ''">
|
|
and ${reportFlag}
|
|
</if>
|
|
<if test="operatorName != null and operatorName != ''">
|
|
and dbo.Get_OperatorDesc(a.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="checkUserSeqNo" resultType="SOScheduledRoutingOutData">
|
|
select seqNo ,CancelReportFlag,a.mat_issueflag,a.site,a.OrderNo,a.ItemNo,a.QtyRequired,a.S_WorkCenterNo,a.operatorId,a.partNo,dbo.Get_Part_Spec(a.site,a.partNo) PartSpec
|
|
,PreviousSeqNo,PreviousBatchNo,materSeqNo from SOScheduledRouting a
|
|
left join user_work_center uwc on a.site=uwc.site and a.S_WorkCenterNo =uwc.WorkCenterNo and uwc.userId=#{userId}
|
|
where seqNo=#{seqNo} and uwc.WorkCenterNo is not null
|
|
</select>
|
|
|
|
<select id="checkLastItemReport" resultType="SORoutingData">
|
|
SELECT max(ItemNo) itemNo,QtyReported FROM [dbo].[SORouting]
|
|
<where>
|
|
<if test="site != null and site != ''">
|
|
AND site = #{site}
|
|
</if>
|
|
and orderNo=#{orderNo} and #{itemNo}>ItemNo
|
|
</where>
|
|
Group by QtyReported
|
|
</select>
|
|
<select id="getStockPrint" resultType="com.heai.modules.production.entity.StockPrintData">
|
|
select a.TransNo,a.Site,a.WareHouseId,a.BatchNo,a.LocationId,a.PartNo,a.OrderNo,a.TransDate,a.Qty,a.PrintFlag,dbo.Get_PartDesc(a.Site,a.PartNo) as partDesc,Round(dbo.Get_Part_NetWeight(a.Site,a.PartNo)*a.Qty/1000,2) weight
|
|
,dbo.Get_WareHouseDesc(a.Site,a.WareHouseId) as wareHouseDesc,dbo.Get_Part_UMID(a.Site,a.PartNo) umid,dbo.get_expiredDate_print(a.Site,a.PartNo,a.BatchNo) expiredDate
|
|
,dbo.Get_StorePrintPartStatus(a.Site,a.PartNo,a.BatchNo) status,isnull(Round(b.QtyOnHand,3),0) QtyOnHand
|
|
from StockPrint a
|
|
left join InventoryStock b on a.Site=b.site and a.WareHouseId=b.WarehouseID and a.PartNo=b.PartNo and a.BatchNo=b.BatchNo and
|
|
a.LocationId=b.LocationId
|
|
<where>
|
|
<if test="startDate != null ">
|
|
and a.TransDate >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null ">
|
|
and #{endDate} >= a.TransDate -1
|
|
</if>
|
|
<if test="site != null and site != ''">
|
|
AND a.site = #{site}
|
|
</if>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
AND a.orderNo LIKE #{orderNo}
|
|
</if>
|
|
<if test="seqNo != null and seqNo != ''">
|
|
AND a.seqNo = #{seqNo}
|
|
</if>
|
|
<if test="printFlag != null and printFlag != ''">
|
|
AND a.printFlag = #{printFlag}
|
|
</if>
|
|
<if test="batchNo != null and batchNo != ''">
|
|
AND a.BatchNo LIKE #{batchNo}
|
|
</if>
|
|
<if test="partNo != null and partNo != ''">
|
|
AND a.PartNo LIKE #{partNo}
|
|
</if>
|
|
</where>
|
|
order by a.TransDate desc
|
|
</select>
|
|
|
|
<update id="updatePrintStock">
|
|
update StockPrint set PrintFlag='Y' where Site=#{site} and TransNo=#{transNo}
|
|
</update>
|
|
<update id="updatePrintInfo">
|
|
update print_info set status='Y' where Site=#{site} and orderref1=#{transNo}
|
|
</update>
|
|
|
|
<select id="checkFirstItem" resultType="SOScheduledRoutingOutData">
|
|
select site,OrderNo,ItemNo from SORouting where orderNo=#{orderNo} and site=#{site} and #{itemNo} >itemNo order by itemNo desc
|
|
</select>
|
|
|
|
<select id="searchSeqNo" resultType="SOScheduledRoutingOutData">
|
|
select top 1 Site,OrderNo,ItemNo,SeqNo,QtyRequired,QtyReported,QtyApprove,TimeRequired,TimeReported,
|
|
BarcodeID,Remark,Crewsize,ClosedFlag,S_ScheduledDate,S_ResourceID,S_ScheduledSeqNo,S_ShiftNo,
|
|
S_WorkCenterNo, EnteredDate,scheduleType,operatorId,partNo,dbo.Get_PartDesc(Site,partNo) as partDesc,
|
|
dbo.Get_OperatorDesc(Site,operatorId) as operatorName,dbo.Get_ItemDesc(site,orderNo,ItemNo) as itemDesc,orderRef1 ,
|
|
dbo.Get_WorkCenterDesc(Site,S_WorkCenterNo) as workCenterDesc , dbo.Get_Part_SpecDesc(Site,partNo) as partSpec,closedFlag,outWorkFlag,ParkFlag,CancelReportFlag
|
|
from SOScheduledRouting
|
|
where site=#{site} and SeqNo=#{seqNo}
|
|
</select>
|
|
|
|
<select id="checkELevels" resultType="Integer">
|
|
select isnull(E_Levels,-1) E_Levels from shoporder where site=#{site} and orderNo=#{orderNo}
|
|
</select>
|
|
|
|
<select id="checkShopOrderForTransfer" resultType="com.heai.modules.production.entity.ShopOrderData">
|
|
select orderNo,PartNo from shoporder where site=#{site} and orderNo=#{orderNo}
|
|
</select>
|
|
<select id="checkReceiveFlag" resultType="com.heai.modules.production.entity.SOOpsTransferData">
|
|
select a.TransNo from SOOpsTransferHeader a left join SOOpsTransferDetail b on a.site=b.site and a.TransNo=b.TransNo
|
|
where a.site=#{site} and b.seqNo=#{seqNo} and a.Status='已录入' and a.NeedReceiveFlag='Y' and a.ToTypeFlag_DB='W'
|
|
</select>
|
|
|
|
<select id="checkNotInspectTransFer" resultType="com.heai.modules.production.entity.SOOpsTransferData">
|
|
select a.TransNo from SOOpsTransferHeader a left join SOOpsTransferDetail b on a.site=b.site and a.TransNo=b.TransNo
|
|
where a.site=#{site} and b.seqNo=#{seqNo} and a.Status='已录入' and a.NeedReceiveFlag='Y' and a.ToTypeFlag_DB='I'
|
|
</select>
|
|
<select id="getSOScheduledRoutingOutData" resultType="SOScheduledRoutingOutData">
|
|
select Site,OrderNo,seqNo,itemNo,S_ShiftNo from SOScheduledRouting where seqNo=#{seqNo}
|
|
</select>
|
|
<select id="checkItemNoForIssue" resultType="SORoutingData">
|
|
select Site,OrderNo,itemNo from SORouting where Site=#{site} and orderNo=#{orderNo} and #{itemNo}>itemNo
|
|
</select>
|
|
<select id="getsfdcTimeHistData" resultType="com.heai.modules.production.entity.SfdcTimeHistData">
|
|
select top 1 site,OrderNo,ItemNo,SeqNo,#{username} as Enteredby ,ClosedFlag,OutWorkFlag from SOScheduledRouting where site=#{site} and SeqNo=#{seqNo} and ClosedFlag='N'
|
|
</select>
|
|
<select id="getsfdcTimeHistAbnormal" resultType="com.heai.modules.production.entity.SfdcTimeHistData">
|
|
select top 1 site,SeqNo,AbnormalCode,AbnormalRemark from SFDC_TimeHist where site=#{site} and SeqNo=#{seqNo} and EventType='D' order by HistSeqNo desc
|
|
</select>
|
|
<select id="getSeqNoSite" resultType="String">
|
|
select site from SOScheduledRouting where SeqNo=#{seqNo}
|
|
</select>
|
|
|
|
<select id="checkSfdcTimeHistData" resultType="com.heai.modules.production.entity.SfdcTimeHistData">
|
|
select site,OrderNo,ItemNo,SeqNo from SFDC_TimeHist where site=#{site} and seqNo=#{seqNo} and EventDesc='开始生产' and CompletedFlag='N'
|
|
</select>
|
|
|
|
<select id="getHistSeqNo" resultType="Integer">
|
|
select isnull(max(HistSeqNo),0)+1 from SFDC_TimeHist where site=#{site} and seqNo=#{seqNo}
|
|
</select>
|
|
<update id="updateSfdcTimeHistDataContinue" >
|
|
Update SFDC_TimeHist set CompletedFlag='Y' ,TillTime=GETDATE(),TillEnteredTime=GETDATE(),TillEnteredBy=#{enteredby},TotalTime=Round(datediff(mi,EventTime,GETDATE())/60.0,2) where SeqNo=#{seqNo,jdbcType=INTEGER} and Site=#{site} and CompletedFlag='N' and EventDesc='暂停生产'
|
|
|
|
</update>
|
|
<update id="updateStopWork" >
|
|
update SOScheduledRouting set OutWorkFlag=#{flag} where Site=#{site} and seqNo=#{seqNo}
|
|
</update>
|
|
<insert id="saveSfdcTimeHistDataStart">
|
|
insert into SFDC_TimeHist (Site,OrderNo,ItemNo,SeqNo,HistSeqNo,EventTime,Enteredby,EventDesc,DowntimeCode,EventType,LinkHistSeqNo,TillTime,TillEnteredTime,
|
|
TillEnteredBy,CompletedFlag,TotalTime,DowntimePhaseIn,RollNo) values
|
|
(#{site},#{orderNo},#{itemNo},#{seqNo},#{histSeqNo},GetDate(),#{enteredby},'开始生产','','P',null,null,null,null,'N',0,'','*')
|
|
</insert>
|
|
<insert id="saveSfdcTimeHistDataStop">
|
|
insert into SFDC_TimeHist (Site,OrderNo,ItemNo,SeqNo,HistSeqNo,EventTime,Enteredby,EventDesc,DowntimeCode,EventType,LinkHistSeqNo,TillTime,TillEnteredTime,
|
|
TillEnteredBy,CompletedFlag,TotalTime,DowntimePhaseIn,RollNo,AbnormalCode,AbnormalRemark) values
|
|
(#{site},#{orderNo},#{itemNo},#{seqNo},#{histSeqNo},GetDate(),#{enteredby},'暂停生产','','D',null,null,null,null,'N',0,'','*',#{abnormalCode},#{abnormalRemark})
|
|
</insert>
|
|
|
|
<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,scheduleType,operatorId,partNo,orderRef1,circulation_seqNo,circulation_qty,PreviousSeqNo,PreviousBatchNo,materSeqNo,jobType 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,scheduleType,operatorId,partNo,orderRef1,jobType,PreviousSeqNo,PreviousBatchNo,materSeqNo) values
|
|
(#{site},#{orderNo},#{itemNo},#{seqNo},#{qtyRequired},0,0,0,0,#{planStartTime},#{planFinishTime},
|
|
#{barcodeID},#{remark},#{crewsize},'N',0,'Y',#{sScheduledDate},#{sResourceID},#{sScheduledSeqNo},#{sShiftNo},
|
|
#{sWorkCenterNo},#{parkFlag},#{timeRequiredOriginal},#{qtyRequiredOriginal},null,'N','N',
|
|
0,GetDate(),'N','N',NULL,NULL,NULL,#{matIssueflag},'N','N',#{scheduleType},#{operatorId},#{partNo},#{orderRef1},#{jobType}
|
|
,#{previousSeqNo},#{previousBatchNo},#{materSeqNo})
|
|
</insert>
|
|
|
|
<update id="closeSchedule">
|
|
update SOScheduledRouting set ClosedFlag='Y' where site=#{site} and seqNo=#{seqNo}
|
|
</update>
|
|
|
|
<select id="getTransData" resultType="com.heai.modules.production.entity.SOOpsTransferData">
|
|
select top 1 a.TransNo,a.Site,b.FromWorkCenterNo WorkCenterNo ,b.OrderNo,b.TransQty,a.TransDate,b.PartNo,b.seqNo,dbo.Get_Part_SpecDesc(a.Site,b.PartNo) partDesc
|
|
,dbo.Get_Part_UMID(a.Site,b.PartNo) umid,'trans' as type ,b.OrderRef5
|
|
FROM SOOpsTransferHeader a left join SOOpsTransferDetail b on a.site=b.site and a.TransNo=b.TransNo
|
|
where a.TransNo=#{transNo} and a.Site=#{site} and ToTypeFlag_DB!='I'
|
|
</select>
|
|
|
|
<select id="getBadPrintData" resultType="com.heai.modules.production.entity.SOOpsTransferData">
|
|
SELECT top 1 b.partNo ,dbo.Get_Part_SpecDesc(b.Site,b.partNo) as partDesc,b.SeqNo,b.S_WorkCenterNo workCenterNo ,b.OrderNo,a.DefectQty transQty,
|
|
dbo.Get_Part_UMID(b.Site,b.partNo) as umid,a.ReportDate as transDate ,b.site ,Round(a.DefectQty*dbo.Get_PartWeightFactorForReport(b.Site,b.partNo,''),3) as orderRef5,a.Remark,
|
|
c.createdBy userName,'bad' as type
|
|
FROM SFDC_DefectHist a
|
|
left join sfdc c on a.Site=c.Site and a.SeqNo=c.SeqNo and a.OrderNo=c.OrderNo and a.ItemNo=c.ItemNo
|
|
left join SOScheduledRouting b on c.AssJobSeqNo=b.SeqNo and a.Site=b.Site
|
|
where a.site=#{site} and b.seqNo=#{seqNo} and a.DefectCode='PQ003'
|
|
order by a.seqNo desc
|
|
</select>
|
|
|
|
<select id="printDefectCard" resultType="com.heai.modules.production.entity.SOOpsTransferData">
|
|
SELECT b.partNo ,dbo.Get_Part_SpecDesc(b.Site,b.partNo) as partDesc,b.SeqNo,b.S_WorkCenterNo workCenterNo ,b.OrderNo,a.DefectQty transQty,
|
|
dbo.Get_Part_UMID(b.Site,b.partNo) as umid,a.ReportDate as transDate ,b.site ,convert(varchar(20),Round(a.DefectQty*dbo.Get_PartWeightFactorForReport(b.Site,b.partNo,''),3) )as orderRef5,a.Remark,
|
|
c.createdBy userName,'bad' as type
|
|
FROM SFDC_DefectHist a
|
|
left join sfdc c on a.Site=c.Site and a.SeqNo=c.SeqNo and a.OrderNo=c.OrderNo and a.ItemNo=c.ItemNo
|
|
left join SOScheduledRouting b on c.AssJobSeqNo=b.SeqNo and a.Site=b.Site
|
|
where a.site=#{site} and a.orderNo=#{orderNo} and a.SeqNo=#{seqNo} and a.ItemNo=#{itemNo} and a.DefectCode='PQ003'
|
|
|
|
</select>
|
|
|
|
<select id="searchTaskTransNo" resultType="String">
|
|
select top 1 TransNo from SOOpsTransferDetail where OrderNo=#{taskNo} and site=#{site}
|
|
</select>
|
|
|
|
<select id="transFerSearch" resultType="com.heai.modules.production.entity.SOOpsTransferData">
|
|
SELECT a.transNo ,a.site,b.seqNo,a.TransDate,b.TransQty ,b.OrderNo ,b.PartNo,c.PartDescription as partDesc,
|
|
case when a.status ='已入库' then '已入库' else '未入库' end as status
|
|
FROM SOOpsTransferHeader a LEFT JOIN SOOpsTransferDetail b on a.TransNo=b.TransNo and a.site=b.Site
|
|
LEFT JOIN Part c on b.PartNo=c.PartNo and b.site=c.site
|
|
|
|
<where>
|
|
and a.Status!='已取消' and a.ToTypeFlag_DB not in ('I','Q')
|
|
<if test="startDate != null ">
|
|
and TransDate >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null ">
|
|
and #{endDate} >= TransDate -1
|
|
</if>
|
|
<if test="site != null and site != ''">
|
|
AND a.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 b.PartNo LIKE #{partNo}
|
|
</if>
|
|
</where>
|
|
ORDER BY a.TransDate
|
|
</select>
|
|
|
|
|
|
<select id="getPartCardPrintData" resultType="com.heai.modules.production.entity.PartCardPrintData">
|
|
select top 1 a.orderNo,a.partNo,c.partDescription+'/'+C.Spec as partDesc,a.QtyRequired,a.S_ScheduledDate,
|
|
dbo.Get_OperatorDesc(a.site,a.operatorId) OperatorName ,c.ToExpireDays,b.TechInfo,c.remark,Round(dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderNo)*a.QtyRequired,2) as weight
|
|
|
|
from SOScheduledRouting a left join ShopOrder b on a.site=b.site and a.OrderNo=b.OrderNo
|
|
left join part c on a.partNo=c.PartNo and a.site=c.site
|
|
where a.site=#{site} and a.seqNo=#{seqNo}
|
|
</select>
|
|
|
|
<select id="checkTool" resultType="com.heai.modules.production.entity.SOToolData">
|
|
select ToolID from SOTool where site=#{site} and OrderNo=#{orderNo} and itemNo=#{itemNo}
|
|
</select>
|
|
|
|
<select id="getHunlianTaskNo" resultType="String">
|
|
select 'HL'+CONVERT(varchar(100), GETDATE(), 112)+ Right( '00000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(TaskNo, 11,4))),0)+1) ,4) from Hunlian_TaskHeader where TaskNo like 'HL'+CONVERT(varchar(100), GETDATE(), 112)+'%'
|
|
</select>
|
|
|
|
<insert id="saveHunlianTaskDetailData" >
|
|
insert into Hunlian_TaskDetail (Site,TaskNo,OrderNo,OrderRef1,OrderRef2,OrderQty,HunlianQty,OrderDate,PartNo,HunlianPartNo)
|
|
|
|
select top 1 #{site},#{taskNo},#{orderNo},#{orderRef1},SO.OrderNo, SOT.OrderQty,#{hunlianQty},#{orderDate},SOT.partNo,#{hunlianPartNo}
|
|
|
|
from SOTaskOrderHeader SOT
|
|
left join ShopOrder t on t.site=#{site} and t.orderNo=#{orderRef1}
|
|
left join ShopOrder SO on SOT.site=SO.Site and t.orderNo=SO.Prelev_order_no and t.E_OriginalOrderType=SO.E_OriginalOrderType and (SO.PartNo like 'RC%' or SO.PartNo like 'SC%' )
|
|
where SOT.site=#{site} and SOT.orderNo=#{orderNo}
|
|
</insert>
|
|
|
|
<select id="getShopOrderScheduledQty" resultType="Double">
|
|
select SUM(QtyRequired-isnull(circulation_qty,0)) from SOScheduledRouting where site=#{site} and OrderNo=#{orderNo} and itemNo=#{itemNo}
|
|
</select>
|
|
|
|
<select id="getOrderNoLotSizeSchedulingSize" resultType="com.heai.modules.production.entity.ShopOrderData">
|
|
select lotSize, dbo.Get_PartPlanQty(site,PartNo,OrderNo) schedulingSize from ShopOrder where site=#{site} and OrderNo=#{orderNo}
|
|
</select>
|
|
|
|
<select id="checkTask" resultType="com.heai.modules.production.entity.HunlianTaskDetailData">
|
|
select OrderNo as orderRef1 ,orderNo_hunlian as orderNo FROM view_KANBAN_SO_Hunlian_Plan
|
|
where site=#{site} and (erpStatus='已取消' or FinishedFlag in ('2','3') or dispatched_hunlian='Y' ) and orderNo_hunlian in
|
|
(select orderNo from Hunlian_TaskDetail where site=#{site} and TaskNo=#{taskNo} )
|
|
</select>
|
|
|
|
<update id="updateSOTaskDispatchedFlag" >
|
|
update SOTaskOrderHeader set dispatched_hunlian =#{flag} where site=#{site} and orderNo in
|
|
(select orderNo from Hunlian_TaskDetail where site=#{site} and TaskNo=#{taskNo} )
|
|
</update>
|
|
|
|
<update id="updateTaskReportFlag" >
|
|
update Hunlian_TaskHeader set ReportFlag=#{flag} ,ReportQty=#{reportQty},reportReal=#{qtyReal} where site=#{site} and TaskNo=#{taskNo}
|
|
</update>
|
|
|
|
<insert id="saveHunlianTaskHeaderData" >
|
|
insert into Hunlian_TaskHeader (Site,TaskNo,TaskQty,PartNo,CreateDate,CreateBy,ReportFlag,ReportQty,DeleteFlag,WareHouseFlag,WareHouseQty,Remark,OrderRef1)
|
|
values(#{site},#{taskNo},#{taskQty},#{partNo},GetDate(),#{createBy},'N',0,'N','N',0,#{remark},#{orderRef1})
|
|
</insert>
|
|
|
|
<select id="getPartNoOnHand" resultType="com.heai.modules.production.entity.InventoryStockSearchData">
|
|
select site,partNo, Round(sum(QtyOnHand),2) QtyOnHand from InventoryStock where site=#{site} and partNo=#{partNo} group by site,partNo
|
|
</select>
|
|
|
|
<select id="getHunlianTaskData" resultType="com.heai.modules.production.entity.HunlianData">
|
|
select a.Site,a.TaskNo,a.TaskQty,a.PartNo,a.CreateDate,a.CreateBy,a.ReportFlag,a.ReportQty,dbo.Get_Part_SpecDesc(a.Site,a.PartNo) as partDesc
|
|
,b.toExpireDays,a.WareHouseFlag,a.remark,a.orderRef1
|
|
from Hunlian_TaskHeader a
|
|
left join part b on a.site=b.site and a.PartNo=b.partNo
|
|
<where>
|
|
and a.deleteFlag='N'
|
|
<if test="startDate != null ">
|
|
and a.CreateDate >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null ">
|
|
and #{endDate} >= a.CreateDate -1
|
|
</if>
|
|
|
|
<if test="reportFlag != null and reportFlag != ''">
|
|
AND a.reportFlag = #{reportFlag}
|
|
</if>
|
|
<if test="partNo != null and partNo != ''">
|
|
AND a.partNo like #{partNo}
|
|
</if>
|
|
|
|
|
|
<if test="taskNo != null and taskNo != ''">
|
|
AND a.taskNo LIKE #{taskNo}
|
|
</if>
|
|
</where>
|
|
ORDER BY a.CreateDate
|
|
</select>
|
|
|
|
<select id="getHunlianTaskDetailData" resultType="com.heai.modules.production.entity.HunlianTaskDetailData">
|
|
select a.Site,a.TaskNo,a.OrderNo,a.OrderRef1,a.OrderRef2,a.OrderQty,a.HunlianQty,a.OrderDate,a.PartNo,a.HunlianPartNo,
|
|
dbo.Get_Part_SpecDesc(a.Site,a.HunlianPartNo) as partDesc
|
|
from Hunlian_TaskDetail a
|
|
|
|
where site=#{site} and TaskNo=#{taskNo}
|
|
</select>
|
|
|
|
<select id="getHunlianTaskDetailDataSum" resultType="com.heai.modules.production.entity.HunlianTaskDetailData">
|
|
select a.Site,a.TaskNo,a.OrderRef2,SUM(a.HunlianQty) HunlianQty,a.HunlianPartNo
|
|
|
|
from Hunlian_TaskDetail a
|
|
|
|
where site=#{site} and TaskNo=#{taskNo}
|
|
GROUP BY a.Site,a.TaskNo,a.OrderRef2,a.HunlianPartNo
|
|
</select>
|
|
|
|
<select id="checkTaskHeader" resultType="com.heai.modules.production.entity.HunlianData">
|
|
select Site,TaskNo,TaskQty,PartNo,CreateDate,CreateBy,ReportFlag,ReportQty,DeleteFlag,DeleteBy,DeleteDate,WareHouseFlag,orderRef1 from Hunlian_TaskHeader
|
|
where site=#{site} and DeleteFlag='N' and TaskNo=#{taskNo}
|
|
</select>
|
|
|
|
<select id="checkTaskOrder" resultType="com.heai.modules.production.entity.HunlianData">
|
|
select orderNo from shopOrder where status in ('已取消','已关闭') and site=#{site} and orderNo in (select orderRef1 from Hunlian_TaskDetail where site=#{site}
|
|
and taskNo=#{taskNo} )
|
|
|
|
</select>
|
|
|
|
<update id="deleteTask">
|
|
update Hunlian_TaskHeader set DeleteFlag='Y',DeleteBy=#{userId},DeleteDate=GetDate() where site=#{site} and TaskNo=#{taskNo}
|
|
</update>
|
|
|
|
|
|
|
|
<update id="updateSOTaskReport" parameterType="com.heai.modules.production.entity.DailyReportInData">
|
|
update SOTaskOrderHeader SET Qtyfinished=Round(#{reportQty}*#{orderQty}/#{taskQty},1),ReportTime=GetDate(),FinishFlag='Y',ReportBy=#{userId} ,InputQty=Round(#{reportQty}*#{hunlianQty}/#{taskQty},1) where OrderNo=#{orderNo} and site =#{site}
|
|
</update>
|
|
|
|
<update id="cancelReportSOTask" parameterType="com.heai.modules.production.entity.HunlianData">
|
|
update SOTaskOrderHeader SET Qtyfinished=0,ReportTime=null,FinishFlag='N',ReportBy=null ,InputQty=0 where site =#{site} and orderNo in (select orderNo from Hunlian_TaskDetail where site =#{site} and taskNo=#{taskNo})
|
|
</update>
|
|
|
|
<insert id="saveSOOpsTransferHeader">
|
|
INSERT INTO SOOpsTransferHeader (TransNo,Site,FromProLineNo,ToProLineNo,ToWarehouseID,FromEnteredby,FromEnteredDate,TransDate,ToReceiver,FromReceiver,
|
|
FromRemark,ToRemark,ConfirmedFlag,ToConfirmedBy,ToEnteredby,LatestUpdatedBy,LatestUpdatedDate,RecordVersion,
|
|
Status,ToTypeFlag_DB,ToTypeFlag,ConfirmedTransNo,need_inspect_flag,NeedReceiveFlag) VALUES
|
|
(#{transNo},#{site},'*','*','*',#{userId},GETDATE(),GETDATE(),'',#{userId},
|
|
'','','N','N','',#{userId},GETDATE(),'0',
|
|
'已录入','W','混炼胶入库','','Y','N')
|
|
</insert>
|
|
<insert id="saveSOOpsTransferDetail">
|
|
INSERT INTO SOOpsTransferDetail (TransNo,Site,ItemNo,FromOpsID,FromWorkCenterNo,ToWorkCenterNo,ToOpsID,OrderNo,PartNo,TransQty,ConfirmQty,TaskNo,InsStatus,
|
|
ToConfirmQty) VALUES
|
|
( #{transNo},#{site},1,1,'*','',0,#{taskNo},#{partNo},#{reportQty},0,#{taskNo},'合格',0)
|
|
</insert>
|
|
|
|
<insert id="saveSOOpsTransferHeaderForShiYanShi">
|
|
INSERT INTO SOOpsTransferHeader (TransNo,Site,FromProLineNo,ToProLineNo,ToWarehouseID,FromEnteredby,FromEnteredDate,TransDate,ToReceiver,FromReceiver,
|
|
FromRemark,ToRemark,ConfirmedFlag,ToConfirmedBy,ToEnteredby,RecordVersion,
|
|
Status,ToTypeFlag_DB,ToTypeFlag,ConfirmedTransNo,need_inspect_flag,NeedReceiveFlag,inspect_remark) VALUES
|
|
(#{transNo},#{site},'*','*','*',#{operatorId},GETDATE(),GETDATE(),'',#{operatorId},
|
|
'','','N','N','','0',
|
|
'已录入','I',#{toTypeFlag},'','Y','N',#{inspectRemark})
|
|
</insert>
|
|
|
|
<insert id="saveSOOpsTransferDetailForShiYanShi">
|
|
INSERT INTO SOOpsTransferDetail (TransNo,Site,ItemNo,FromOpsID,FromWorkCenterNo,ToWorkCenterNo,ToOpsID,OrderNo,PartNo,TransQty,ConfirmQty,TaskNo,InsStatus,
|
|
ToConfirmQty,seqNo) VALUES
|
|
( #{transNo},#{site},1,1,#{sWorkCenterNo},'',0,#{orderNo},#{partNo},#{qtyRequired},0,#{orderNo},'待检验',0,#{seqNo})
|
|
</insert>
|
|
|
|
<select id="getTransNo" resultType="String">
|
|
select 'OT'+CONVERT(varchar(100), GETDATE(), 112)+ Right( '00000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(TransNo, 11,4))),0)+1) ,4)
|
|
from SOOpsTransferHeader where TransNo like 'OT'+CONVERT(varchar(100), GETDATE(), 112)+'%'
|
|
</select>
|
|
<select id="checkLocationId" resultType="com.heai.modules.production.entity.LocationData">
|
|
select LocationID,Site,LocationName,WareHouseID,Keeper,Active
|
|
from Location where site=#{site} and LocationID=#{locationId}
|
|
</select>
|
|
<delete id="deleteSOOpsTransferHeader">
|
|
update SOOpsTransferHeader set Status='已取消' where site=#{site} and transNo=#{transNo}
|
|
</delete>
|
|
|
|
<delete id="deleteSOOpsTransferDetail">
|
|
delete from SOOpsTransferDetail where site=#{site} and transNo=#{transNo}
|
|
</delete>
|
|
|
|
<select id="getSfdcList" resultType="com.heai.modules.production.entity.SfdcCancel">
|
|
select a.site,a.OrderNo,a.ItemNo ,a.SeqNo,a.WorkCenterNo,a.ReportDate,a.OperatorID,a.ReportQty,a.ApproveQty,a.ReportedManfTime,a.StatisticDate,
|
|
a.AssJobSeqNo,a.Scheduled_ResourceId ResourceID,b.S_ShiftNo ShiftNo,b.partNo,dbo.Get_ItemDesc(a.site,a.OrderNo,a.ItemNo) operation_desc,c.OperatorName,b.S_ShiftNo ShiftDesc,e.ResourceDesc,Reverseflag
|
|
,a.reportWeight,a.approveWeight,a.moldQty,a.stopTime,dbo.Get_Part_Spec(a.site,b.partNo) partSpec,dbo.Get_PartDesc(a.site,b.partNo) PartDesc,wasteWeight,b.jobType,
|
|
f.Remark as scrapRemark,f.DefectQty as scrapQty,g.Remark as acceptRemark,g.DefectQty as acceptQty
|
|
from sfdc a LEFT JOIN SOScheduledRouting b on a.Site=b.Site and a.AssJobSeqNo=b.SeqNo
|
|
left join Operator c on a.site=c.site and a.OperatorID=c.OperatorID
|
|
left join WorkCenterResource e on a.Site=e.Site and a.Scheduled_ResourceId =e.ResourceID and a.WorkCenterNo=e.WorkCenterNo
|
|
left join SFDC_DefectHist f on a.site=f.site and a.OrderNo=f.OrderNo and a.seqNo=f.SeqNo and f.DefectCode='PQ001'
|
|
left join SFDC_DefectHist g on a.site=g.site and a.OrderNo=g.OrderNo and a.seqNo=g.SeqNo and g.DefectCode='PQ003'
|
|
<where>
|
|
and a.AssJobSeqNo is not null
|
|
<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="partDesc != null and partDesc != ''">
|
|
and dbo.Get_Part_SpecDesc(a.site,b.partNo) like #{partDesc}
|
|
</if>
|
|
<if test="operatorName != null and operatorName != ''">
|
|
and c.OperatorName like #{operatorName}
|
|
</if>
|
|
<if test="resourceId != null and resourceId != ''">
|
|
and a.Scheduled_ResourceId = #{resourceId}
|
|
</if>
|
|
<if test="shiftNo != null and shiftNo != ''">
|
|
and b.S_ShiftNo = #{shiftNo}
|
|
</if>
|
|
<if test="startDate != null ">
|
|
and a.ReportDate >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null ">
|
|
and #{endDate} >= a.ReportDate
|
|
</if>
|
|
<if test="seqNo != null and seqNo != '' ">
|
|
and a.AssJobSeqNo = #{seqNo}
|
|
</if>
|
|
</where>
|
|
order by a.ReportDate desc
|
|
</select>
|
|
|
|
<update id="changeReceiveFlag">
|
|
update SOOpsTransferHeader set NeedReceiveFlag=#{flag} from SOOpsTransferDetail b where SOOpsTransferHeader.site=b.site
|
|
and SOOpsTransferHeader.transNo=b.transNo and SOOpsTransferHeader.status='已录入' and SOOpsTransferHeader.ToTypeFlag_DB='W' and
|
|
b.seqNo=#{seqNo} and SOOpsTransferHeader.site=#{site}
|
|
</update>
|
|
|
|
<select id="getAllDepartment" resultType="OperatorData">
|
|
select distinct isnull(Department,'') Department from Operator
|
|
</select>
|
|
|
|
<update id="updateLastStartTime" >
|
|
update SORoutingOutput set LastStartTime=GetDate() where Site=#{site} and orderNo=#{orderNo} and itemNo=#{itemNo}
|
|
</update>
|
|
|
|
<select id="checkSORoutingOutput" resultType="SOScheduledRoutingOutData">
|
|
select site,orderNo from SORoutingOutput where Site=#{site} and orderNo=#{orderNo} and itemNo=#{itemNo}
|
|
</select>
|
|
|
|
<insert id="createSORoutingOutput" >
|
|
insert into SORoutingOutput (Site,OrderNo,ItemNo,TotalFinishedQty) values
|
|
(#{site},#{orderNo},#{itemNo},0)
|
|
</insert>
|
|
|
|
<select id="getLevelOneOrderNo" resultType="SOScheduledRoutingOutData">
|
|
select site,E_OriginalOrderNo OrderNo from shopOrder where orderNo=#{orderNo}
|
|
</select>
|
|
|
|
<update id="updateStockNewDate">
|
|
update InventoryStock set ExpiredDate_new=#{newDate} where Site=#{site} and WarehouseID=#{warehouseID} and PartNo=#{partNo} and BatchNo=#{barchNo} and LocationID=#{locationID}
|
|
</update>
|
|
|
|
<select id="checkTV" resultType="com.heai.modules.production.entity.TvSopBaseData">
|
|
select tv_id,work_station,now_seqNo,now_operator,sopAddress,badAddress from tv_sop_base
|
|
where tv_id=#{tvId}
|
|
</select>
|
|
|
|
<update id="updateTV" >
|
|
update Operator set tv_id=#{tvId} where site=#{site} and OperatorID=#{operatorID}
|
|
</update>
|
|
|
|
<select id="getTvList" resultType="com.heai.modules.production.entity.TvSopBaseData">
|
|
select tv_id,work_station,now_seqNo,now_operator,sopAddress,badAddress from tv_sop_base
|
|
<where>
|
|
<if test="tvId != null and tvId != ''">
|
|
and tv_id like #{tvId}
|
|
</if>
|
|
|
|
<if test="workStation != null and workStation != ''">
|
|
AND work_station = #{workStation}
|
|
</if>
|
|
|
|
</where>
|
|
</select>
|
|
|
|
<update id="updateWorkStation">
|
|
update tv_sop_base set work_station=#{workStation} where tv_id=#{tvId}
|
|
</update>
|
|
|
|
<select id="getPreviousSOSData" resultType="SOScheduledRoutingOutData">
|
|
select seqNo,PreviousSeqNo,PreviousBatchNo,materSeqNo from SOScheduledRouting where seqNo=#{previousSeqNo,jdbcType=INTEGER}
|
|
</select>
|
|
|
|
<update id="updatePreviousSOSData">
|
|
update SOScheduledRouting set PreviousSeqNo=#{previousSeqNo,jdbcType=INTEGER},PreviousBatchNo=#{previousBatchNo},materSeqNo=#{materSeqNo,jdbcType=INTEGER}
|
|
where seqNo=#{seqNo}
|
|
</update>
|
|
|
|
<select id="sfdcCheck" resultType="com.heai.modules.production.entity.SfdcCancel">
|
|
select Site,OrderNo,ItemNo,SeqNo from SFDC where AssJobSeqNo=#{seqNo}
|
|
</select>
|
|
</mapper>
|