赫艾后端
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.
 
 
 
 
 
 

184 lines
12 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.board.dao.BoardMapper">
<select id="getWeekShipmentBoardData" resultType="com.heai.modules.board.entity.ViewKanbanCODelNotifyData">
select PartSpec,NotifyQty,QtyPerBox,WeightperBag,BagsperBox,BoxType,WeightperBox,PlanShipDate,Site,FinishedFlag,Operation_SZ,remark,
Operation_HK,abbreviateName FROM view_KANBAN_CODelNotify
<where>
<if test="startDate != null ">
AND PlanShipDate >= #{startDate}
</if>
<if test="endDate != null ">
AND #{endDate} >= PlanShipDate
</if>
</where>
Order By PlanShipDate
</select>
<select id="productionBlankingBoard" resultType="com.heai.modules.board.entity.ViewKanbanSoHunlianPlanData">
select OrderNo,site,PartNo,PartDescSpec,ComponentPartNo,CompPartDescSpec,SJPH1,SJPH_QtyReq1,SJPH2,SJPH_QtyReq2,QtyRequired,QtyFinished,PlanStartDate,CompOrderNo,
FinishedFlag,erpStatus FROM view_KANBAN_SO_Hunlian_Plan
<where>
<if test="startDate != null ">
AND PlanStartDate >= #{startDate}
</if>
<if test="endDate != null ">
AND #{endDate} >= PlanStartDate
</if>
</where>
Order By PlanStartDate
</select>
<select id="soLiuhuaBoard" resultType="com.heai.modules.board.entity.ViewKanbanSoLiuhuaPlanData">
select OrderNo,site,PartNo,PartDescSpec,QtyRequired,QtyFinished,PlanStartDate,erpStatus,FinishedFlag FROM view_KANBAN_SO_Liuhua_Plan
<where>
<if test="startDate != null ">
AND PlanStartDate >= #{startDate}
</if>
<if test="endDate != null ">
AND #{endDate} >= PlanStartDate
</if>
</where>
Order By PlanStartDate
</select>
<select id="productionBlankingSearch" resultType="com.heai.modules.board.entity.ViewKanbanSoHunlianPlanData" parameterType="com.heai.modules.production.entity.DailyPlanInData">
select OrderNo,site,PartDescSpec,ComponentPartNo,CompPartDescSpec,SJPH1,SJPH_QtyReq1,SJPH2,SJPH_QtyReq2,QtyRequired,QtyFinished,PlanStartDate,CompOrderNo,
FinishedFlag,erpStatus,dispatched_hunlian dispatchedHunlian ,orderNo_hunlian FROM view_KANBAN_SO_Hunlian_Plan
<where>
<if test="sql != null ">
AND #{sql} >= PlanStartDate
</if>
<if test="orderNo != null and orderNo != ''">
AND OrderNo like #{orderNo}
</if>
<if test="partDescSpec != null and partDescSpec != ''">
AND PartDescSpec like #{partDescSpec}
</if>
and dispatched_hunlian='N'
</where>
UNION ALL
SELECT null,site,null,ComponentPartNo,null,null,null,null,null,null,null,null,null,null,null,null,null
FROM view_KANBAN_SO_Hunlian_Plan
GROUP BY site,ComponentPartNo
ORDER BY ComponentPartNo,PlanStartDate desc
</select>
<select id="transFerBoard" resultType="TransFerBoardData" >
SELECT a.transNo ,a.site,b.seqNo,a.TransDate,b.TransQty-b.ConfirmQty as qty ,b.OrderNo ,b.PartNo,c.PartDescription as partDesc,
case when s.E_Levels=0 then '产成品' when s.E_Levels=1 then '半成品' else '混炼胶' end as type
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
LEFT JOIN ShopOrder s on a.site=s.site and b.orderNo=s.OrderNo
where a.Status='已录入' and s.E_Levels !=2 ORDER BY a.TransDate
</select>
<select id="transFerBoardForHunlian" resultType="TransFerBoardData" >
SELECT a.transNo ,a.site,b.seqNo,a.TransDate,b.TransQty-b.ConfirmQty as qty ,b.OrderNo ,b.PartNo,c.PartDescription as partDesc,
'混炼胶' as type
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 a.Status='已录入' and ToTypeFlag='混炼胶入库' ORDER BY a.TransDate
</select>
<select id="SORoutingBoard" resultType="SORoutingData" >
SELECT a.site,a.OrderNo,a.ItemNo,a.OperationDesc,a.PartNo,dbo.Get_PartDesc(a.Site,a.PartNo) as PartDesc,a.QtyRequired,
a.QtyReported,a.QtyApprove, isnull(SOP.TotalFinishedQty,0) lastApproveQty,b.NeedDate as planFinishTime
from SORouting a left join ShopOrder b on a.site=b.site and a.orderNo=b.orderNo
where b.E_Levels in (1,0) and (a.itemNo =10 or a.QtyRequired>a.QtyReported)
order by planFinishTime
</select>
<select id="SORoutingBoardForXiuBian" resultType="SORoutingData" >
SELECT a.site,a.OrderNo,a.ItemNo,a.OperationDesc,a.PartNo,dbo.Get_PartDesc(a.Site,a.PartNo) as PartDesc,a.QtyRequired,
a.QtyReported,a.QtyApprove,isnull(SOP.TotalFinishedQty,0) lastApproveQty,b.NeedDate as planFinishTime,dbo.Get_SORouting_ClosedFlag(a.site,a.OrderNo,a.ItemNo) as ClosedFlag
from SORouting a left join ShopOrder b on a.site=b.site and a.orderNo=b.orderNo
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 b.E_Levels =0 and (b.status not in ('已取消','已关闭','已停工','已计划') and a.QtyRequired>a.QtyReported ) and dbo.Get_WorkCenter_ProLineNo(a.site,a.WorkCenterNo)='TRIMMING'
and( (isnull(SOP.TotalFinishedQty,0)>0 and isnull(SOP.TotalFinishedQty,0)>a.QtyReported) or a.itemNo=10) and b.enterDate>'2022-01-01'
order by planFinishTime
</select>
<select id="SORoutingBoardForJianYan" resultType="SORoutingData" >
SELECT a.site,a.OrderNo,a.ItemNo,a.OperationDesc,a.PartNo,dbo.Get_PartDesc(a.Site,a.PartNo) as PartDesc,a.QtyRequired,
a.QtyReported,a.QtyApprove,isnull(SOP.TotalFinishedQty,0) lastApproveQty,b.NeedDate as planFinishTime,dbo.Get_SORouting_ClosedFlag(a.site,a.OrderNo,a.ItemNo) as ClosedFlag
from SORouting a left join ShopOrder b on a.site=b.site and a.orderNo=b.orderNo
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 b.E_Levels =0 and (b.status not in ('已取消','已关闭','已停工','已计划') and a.QtyRequired>a.QtyReported) and dbo.Get_WorkCenter_ProLineNo(a.site,a.WorkCenterNo)='INSPECT'
and( (isnull(SOP.TotalFinishedQty,0)>0 and isnull(SOP.TotalFinishedQty,0)>a.QtyReported) or a.itemNo=10) and b.enterDate>'2022-01-01'
order by planFinishTime
</select>
<select id="SORoutingBoardForShuiZhu" resultType="SORoutingData" >
SELECT a.site,a.OrderNo,a.ItemNo,a.OperationDesc,a.PartNo,dbo.Get_PartDesc(a.Site,a.PartNo) as PartDesc,a.QtyRequired,
a.QtyReported,a.QtyApprove,isnull(SOP.TotalFinishedQty,0) lastApproveQty,b.NeedDate as planFinishTime,dbo.Get_SORouting_ClosedFlag(a.site,a.OrderNo,a.ItemNo) as ClosedFlag
from SORouting a left join ShopOrder b on a.site=b.site and a.orderNo=b.orderNo
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 b.E_Levels =0 and (b.status not in ('已取消','已关闭','已停工','已计划') and a.QtyRequired>a.QtyReported) and dbo.Get_WorkCenter_ProLineNo(a.site,a.WorkCenterNo)='TREAT'
and( (isnull(SOP.TotalFinishedQty,0)>0 and isnull(SOP.TotalFinishedQty,0)>a.QtyReported) or a.itemNo=10) and b.enterDate>'2022-01-01'
order by planFinishTime
</select>
<select id="SORoutingBoardForBaoZhuang" resultType="SORoutingData" >
SELECT a.site,a.OrderNo,a.ItemNo,a.OperationDesc,a.PartNo,dbo.Get_PartDesc(a.Site,a.PartNo) as PartDesc,a.QtyRequired,
a.QtyReported,a.QtyApprove,isnull(SOP.TotalFinishedQty,0) lastApproveQty,b.NeedDate as planFinishTime,dbo.Get_SORouting_ClosedFlag(a.site,a.OrderNo,a.ItemNo) as ClosedFlag
from SORouting a left join ShopOrder b on a.site=b.site and a.orderNo=b.orderNo
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 b.E_Levels =0 and (b.status not in ('已取消','已关闭','已停工') and a.QtyRequired>a.QtyReported) and dbo.Get_WorkCenter_ProLineNo(a.site,a.WorkCenterNo)='PACKING'
and( (isnull(SOP.TotalFinishedQty,0)>0 and isnull(SOP.TotalFinishedQty,0) >a.QtyReported) or a.itemNo=10) and b.enterDate>'2022-01-01'
order by planFinishTime
</select>
<select id="SeqNoForLiuHua" resultType="SORoutingData" >
SELECT a.site,a.OrderNo,a.seqNo,a.PartNo,dbo.Get_PartDesc(a.Site,a.PartNo) as PartDesc,a.QtyRequired,
a.QtyReported,a.QtyApprove,a.S_ScheduledDate as planStartTime,dbo.Get_OperatorDesc(a.Site,a.operatorId) OperatorDesc,
S_ResourceID ResourceId,S_ShiftNo ShiftNo
from SOScheduledRouting a where a.ClosedFlag='N' and a.scheduleType='日计划派工单'
order By a.S_ScheduledDate,a.seqNo
</select>
<select id="getStockPrintList" resultType="com.heai.modules.production.entity.StockPrintData">
select a.PrintQty,b.TransNo,b.Site,b.WareHouseId,b.BatchNo,b.LocationId,b.PartNo,b.OrderNo,b.TransDate,b.Qty,b.PrintFlag,b.site+'|'+ b.PartNo+'|'+b.WareHouseId+'|'+b.BatchNo+'|'+b.LocationId as seqNo
,dbo.Get_Part_DescSpec(a.Site,b.PartNo) partDesc,dbo.Get_WareHouseDesc(b.Site,b.WareHouseId) as wareHouseDesc,dbo.Get_Part_UMID(b.Site,b.PartNo) umid
from print_info a left join StockPrint b on a.site=b.site and a.orderref1=b.TransNo where a.status='N' and a.orderref2='库存标签'
</select>
<select id="getStockPrintListHunlian" resultType="com.heai.modules.production.entity.StockPrintData">
select a.PrintQty,b.TransNo,b.Site,b.WareHouseId,b.BatchNo,b.LocationId,b.PartNo,b.OrderNo,b.TransDate,b.Qty,b.PrintFlag,b.site+'|'+ b.PartNo+'|'+b.WareHouseId+'|'+b.BatchNo+'|'+b.LocationId as seqNo
,dbo.Get_Part_DescSpec(a.Site,b.PartNo) partDesc,dbo.Get_WareHouseDesc(b.Site,b.WareHouseId) as wareHouseDesc,dbo.Get_Part_UMID(b.Site,b.PartNo) umid
from print_info a left join StockPrint b on a.site=b.site and a.orderref1=b.TransNo where a.status='N' and a.orderref2='混炼库存标签'
</select>
<select id="PODetailForW" resultType="POBoardData">
Select Convert(float(8),T.ReceiptNo) as ReceiptNo,D.ItemNo,T.ReceiveDate,T.EnterDate,T.SupplierID,T.Receiver,T.Username,
T.DeliveryNoteNo,T.Remark,T.WarehouseID,s.SupplierName,W.WarehouseName,T.Site,D.PartNo,P.PartDescription,P.Spec,P.UMid,
D.ArriveQty,D.POUmID,D.ConvertFactor,D.Status,D.QtytoInspect,D.QtyInspected,D.QtyApproved,D.QtyReturned,D.QtyReplace,
D.QtyScrapt,D.QtyToReceived,D.QtyReceived,D.LocationID,D.OrderNo,D.OrderItemNo,D.NeedInspectFlag,D.SampleInspectionLevelNo,
D.SampleInspectionMethodID,
(Case when D.InspectCode='F' then '全检' when D.InspectCode='Q' then '数量抽检' when D.InspectCode='P' then '比例抽检' when D.InspectCode='V' then '不固定抽检' end) as InspectCode,
D.QtySample,D.PercentSample
from POReceipt as T,POReceiptDetail as D,Warehouse as W,Part as P,Supplier as S where T.Site=D.Site
and T.ReceiptNo=D.ReceiptNo and T.Site=W.Site and T.WareHouseID=W.WareHouseID and D.Site=P.Site and
D.PartNo=P.PartNo and D.NeedInspectFlag='Y' and T.Site=S.Site and T.SupplierID=S.SupplierID and
round(D.ArriveQty,3)>round(D.QtyInspected_New,3) and D.Status!='已取消'
Order by
Convert(float(8),T.ReceiptNo)
</select>
<select id="getSiteData" resultType="com.heai.modules.production.entity.SiteData">
Select * from Site
</select>
</mapper>