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

500 lines
30 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 abbreviateName,CustomerPONo,DelNotifyNo,PlanShipDate,PartSpec,NotifyQty,forwarderName,EnteredDate,Remark,round(isnull(dbo.Get_PartTotalStock(site,partNo),0),2) stock ,finishedFlag from (
select abbreviateName,CustomerPONo,DelNotifyNo,PlanShipDate,PartSpec,NotifyQty,forwarderName,EnteredDate,Remark,site,partNo,finishedFlag from view_KANBAN_CODelNotify_new
<where>
<if test="startDate != null ">
AND PlanShipDate >= #{startDate}
</if>
<if test="endDate != null ">
AND #{endDate} >= PlanShipDate
</if>
</where>
) a
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,partNo1,SJPH1,dbo.Get_PartQtyOnHand(site,partNo1) as inventory1,SJPH_QtyReq1,partNo2,SJPH2,dbo.Get_PartQtyOnHand(site,partNo2) as inventory2,SJPH_QtyReq2,QtyRequired,QtyFinished,PlanStartDate,CompOrderNo,
FinishedFlag,erpStatus,dispatched_hunlian dispatchedHunlian ,orderNo_hunlian ,dbo.Get_E_OriginalOrderTypeDesc(site, OrderNo) orderTypeDesc
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>
<if test="soTaskNo != null and soTaskNo != ''">
AND orderNo_hunlian like #{soTaskNo}
</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,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.spec+'|'+isnull(c.PartDescription,'') as partDesc,
case when b.PartNo like 'FP%' then '产成品' else '半成品' end as type
,a.NeedReceiveFlag
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 b.PartNo not like 'RC%' and b.PartNo not like 'SC%' and ToTypeFlag_db!='I' 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 ,a.NeedReceiveFlag
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='混炼胶入库' and ToTypeFlag_db!='I' 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.PartNo not like 'RC%' and b.PartNo not like 'SC%' and (a.itemNo =10 or a.QtyRequired>a.QtyReported)
order by planFinishTime
</select>
<select id="SORoutingBoardForXiuBian" resultType="SORoutingData" >
SELECT a.site,
a.OrderNo,
T.SeqNo,
a.OperationDesc,
a.PartNo,
dbo.Get_Part_Spec(a.Site,a.PartNo) as PartDesc,
dbo.Get_PartRemark(a.Site,a.PartNo) as remark,
T.QtyRequired,
T.QtyReported,
T.QtyApprove,
isnull(SOP.QtyApprove,0) lastApproveQty,
T.OutWorkFlag as ClosedFlag
from SOScheduledRouting T
LEFT JOIN SOScheduledRouting SOP ON SOP.site=t.site and SOP.OrderNo=t.OrderNo and SOP.SeqNo = isnull(T.PreviousSeqNo,-1)
,SORouting a
left join ShopOrder b on a.site=b.site and a.orderNo=b.orderNo
where T.Site = A.Site AND T.OrderNo = A.OrderNo AND T.ItemNo = A.ItemNo AND T.ClosedFlag = 'N' AND (T.OutWorkFlag = 'N' OR t.S_ScheduledDate=cast(GetDate() as Date) )
and dbo.Get_WorkCenter_ProLineNo(a.site,a.WorkCenterNo)='TRIMMING'
and b.status!='已关闭' and b.status!='已取消'
and b.enterDate>'2022-01-01'
order by T.S_ScheduledDate
</select>
<select id="SORoutingBoardForJianYan" resultType="SORoutingData" >
SELECT a.site,
a.OrderNo,
T.SeqNo,
a.OperationDesc,
a.PartNo,
dbo.Get_Part_Spec(a.Site,a.PartNo) as PartDesc,
T.QtyRequired,
T.QtyReported,
T.QtyApprove,
isnull(SOP1.QtyApprove,0) lastApproveQty,
b.NeedDate as planFinishTime,
S90.TextValue as remark,
T.OutWorkFlag as ClosedFlag
from SOScheduledRouting T
LEFT JOIN SOScheduledRouting SOP1 ON SOP1.site=t.site and SOP1.OrderNo=t.OrderNo and SOP1.SeqNo = isnull(T.PreviousSeqNo,-1)
,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)
Left Join PartSubPropertiesValue as S90 On S90.Site=a.Site and S90.PartNo=a.PartNo and S90.PropertiesItemNo='SPECIAL CHECK'
where T.Site = A.Site AND T.OrderNo = A.OrderNo AND T.ItemNo = A.ItemNo AND T.ClosedFlag = 'N' AND (T.OutWorkFlag = 'N' OR t.S_ScheduledDate=cast(GetDate() as Date) )
and b.status!='已关闭' and b.status!='已取消'
and dbo.Get_WorkCenter_ProLineNo(a.site,a.WorkCenterNo)='INSPECT'
and b.enterDate>'2022-01-01'
order by T.S_ScheduledDate
</select>
<select id="SORoutingBoardForShuiZhu" resultType="com.heai.modules.board.entity.SORoutingBoardData" >
SELECT a.site,
a.OrderNo,
T.SeqNo,
a.OperationDesc,
a.PartNo,
dbo.Get_Part_Spec(a.Site,a.PartNo) as PartDesc,
T.QtyRequired,
T.QtyReported,
T.QtyApprove,
isnull(SOP1.QtyApprove,0) lastApproveQty,
b.NeedDate as planFinishTime,
'温:' + Convert(varchar(100),isnull(S90.NumValue,0)) + ' ' + '时:' + Convert(varchar(100),isnull(S91.NumValue,0)) as text1,
'温:' + Convert(varchar(100),isnull(S92.NumValue,0)) + ' ' + '时:' + Convert(varchar(100),isnull(S93.NumValue,0)) as text2,
p3.TextValue text3,
T.OutWorkFlag as ClosedFlag
from SOScheduledRouting T
LEFT JOIN SOScheduledRouting SOP1 ON SOP1.site=t.site and SOP1.OrderNo=t.OrderNo and SOP1.SeqNo = isnull(T.PreviousSeqNo,-1)
,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)
Left Join PartSubPropertiesValue as S90 On S90.Site=a.Site and S90.PartNo=a.PartNo and S90.RecordType='P' and S90.SubCodeSeqNo=1 and S90.PropertiesItemNo='WATER TEMP'
Left Join PartSubPropertiesValue as S91 On S91.Site=a.Site and S91.PartNo=a.PartNo and S91.RecordType='P' and S91.SubCodeSeqNo=1 and S91.PropertiesItemNo='WATER TIME'
Left Join PartSubPropertiesValue as S92 On S92.Site=a.Site and S92.PartNo=a.PartNo and S92.RecordType='P' and S92.SubCodeSeqNo=1 and S92.PropertiesItemNo='POST CURE-TEMP'
Left Join PartSubPropertiesValue as S93 On S93.Site=a.Site and S93.PartNo=a.PartNo and S93.RecordType='P' and S93.SubCodeSeqNo=1 and S93.PropertiesItemNo='POST CURE-TIME'
LEFT JOIN PartSubPropertiesValue p3 on p3.site=a.site and p3.PartNo=a.PartNo and p3.PropertiesItemNo='MATERIAL'
where T.Site = A.Site AND T.OrderNo = A.OrderNo AND T.ItemNo = A.ItemNo AND T.ClosedFlag = 'N' AND (T.OutWorkFlag = 'N' OR t.S_ScheduledDate=cast(GetDate() as Date) )
and a.partNo like 'FP%'
and b.status!='已关闭' and b.status!='已取消'
and dbo.Get_WorkCenter_ProLineNo(a.site,a.WorkCenterNo)='TREAT'
and b.enterDate>'2022-01-01'
order by T.S_ScheduledDate
</select>
<select id="SORoutingBoardForBaoZhuang" resultType="com.heai.modules.board.entity.SORoutingBoardData" >
SELECT a.site,
a.OrderNo,
T.SeqNo,
a.OperationDesc,
a.PartNo,
dbo.Get_Part_Spec(a.Site,a.PartNo) as PartDesc,
T.QtyRequired,
T.QtyReported,
T.QtyApprove,
isnull(SOP.QtyApprove,0) lastApproveQty,
T.S_ScheduledDate as planFinishTime,
isnull(CONVERT(varchar(30), p1.NumValue),p1.TextValue) text2,p2.NumValue num2,p3.TextValue text1,p4.TextValue text3,
T.OutWorkFlag as ClosedFlag
from SOScheduledRouting T
LEFT JOIN SOScheduledRouting SOP ON SOP.site=t.site and SOP.OrderNo=t.OrderNo and SOP.SeqNo = isnull(T.PreviousSeqNo,-1)
,SORouting a left join ShopOrder b on a.site=b.site and a.orderNo=b.orderNo
LEFT JOIN PartSubPropertiesValue p1 on p1.site=a.site and p1.PartNo=a.PartNo and p1.PropertiesItemNo='BAG'
LEFT JOIN PartSubPropertiesValue p2 on p2.site=a.site and p2.PartNo=a.PartNo and p2.PropertiesItemNo='QTY'
LEFT JOIN PartSubPropertiesValue p3 on p3.site=a.site and p3.PartNo=a.PartNo and p3.PropertiesItemNo='CARTON'
LEFT JOIN PartSubPropertiesValue p4 on p4.site=a.site and p4.PartNo=a.PartNo and p4.PropertiesItemNo='BAG TYPE'
where T.Site = A.Site AND T.OrderNo = A.OrderNo AND T.ItemNo = A.ItemNo AND T.ClosedFlag = 'N' AND (T.OutWorkFlag = 'N' OR t.S_ScheduledDate=cast(GetDate() as Date) )
AND a.partNo like 'FP%'
and dbo.Get_WorkCenter_ProLineNo(a.site,a.WorkCenterNo)='PACKING'
and b.status!='已关闭' and b.status!='已取消'
and T.S_ScheduledDate >'2022-01-01'
order by T.S_ScheduledDate
</select>
<select id="SeqNoForLiuHua" resultType="com.heai.modules.board.entity.SORoutingBoardData" >
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,
a.S_ResourceID ResourceId,a.S_ShiftNo ShiftNo,a.OutWorkFlag
,P1.TextValue text1,Round(p2.NumValue*a.QtyRequired/1000,2) num1,P3.TextValue text2,p4.TextValue text3
from SOScheduledRouting a left join ShopOrder b on a.site=b.site and a.OrderNo=b.OrderNo
LEFT JOIN PartSubPropertiesValue p1 on p1.site=a.site and p1.PartNo=a.PartNo and p1.PropertiesItemNo='MATERIAL TYPE'
LEFT JOIN PartSubPropertiesValue p2 on p2.site=a.site and p2.PartNo=a.PartNo and p2.PropertiesItemNo='GROSS WEIGHT'
LEFT JOIN PartSubPropertiesValue p3 on p3.site=a.site and p3.PartNo=a.PartNo and p3.PropertiesItemNo='DUROA'
LEFT JOIN PartSubPropertiesValue p4 on p4.site=a.site and p4.PartNo=a.PartNo and p4.PropertiesItemNo='COLOR'
where a.ClosedFlag='N' and a.scheduleType='日计划派工单' and dbo.Get_WorkCenter_ProLineNo(a.site,a.S_WorkCenterNo)!='EXTRUSIO' and b.status!='已关闭' and b.status!='已取消'
order By a.S_ScheduledDate,a.seqNo
</select>
<select id="SeqNoForLiuHuaJiChu" resultType="com.heai.modules.board.entity.SORoutingBoardData" >
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,
a.S_ResourceID ResourceId,a.S_ShiftNo ShiftNo
,P1.NumValue num1,P2.NumValue num2,P3.NumValue num3,P4.NumValue num4,P5.NumValue num5,P6.NumValue num6,
P7.NumValue num7,P8.NumValue num8,P9.NumValue num9,a.OutWorkFlag
from SOScheduledRouting a left join ShopOrder b on a.site=b.site and a.OrderNo=b.OrderNo
LEFT JOIN PartSubPropertiesValue p1 on p1.site=a.site and p1.PartNo=a.PartNo and p1.CodeNo='EXTRUSION' and p1.PropertiesItemNo='CHANNEL 1'
LEFT JOIN PartSubPropertiesValue p2 on p2.site=a.site and p2.PartNo=a.PartNo and p2.CodeNo='EXTRUSION' and p2.PropertiesItemNo='CHANNEL 2'
LEFT JOIN PartSubPropertiesValue p3 on p3.site=a.site and p3.PartNo=a.PartNo and p3.CodeNo='EXTRUSION' and p3.PropertiesItemNo='CHANNEL 3'
LEFT JOIN PartSubPropertiesValue p4 on p4.site=a.site and p4.PartNo=a.PartNo and p4.CodeNo='EXTRUSION' and p4.PropertiesItemNo='CHANNEL 4'
LEFT JOIN PartSubPropertiesValue p5 on p5.site=a.site and p5.PartNo=a.PartNo and p5.CodeNo='EXTRUSION' and p5.PropertiesItemNo='CHANNEL 5'
LEFT JOIN PartSubPropertiesValue p6 on p6.site=a.site and p6.PartNo=a.PartNo and p6.CodeNo='EXTRUSION' and p6.PropertiesItemNo='HEAT HEAD'
LEFT JOIN PartSubPropertiesValue p7 on p7.site=a.site and p7.PartNo=a.PartNo and p7.CodeNo='EXTRUSION' and p7.PropertiesItemNo='HEAD SPEED'
LEFT JOIN PartSubPropertiesValue p8 on p8.site=a.site and p8.PartNo=a.PartNo and p8.CodeNo='EXTRUSION' and p8.PropertiesItemNo='TUNNEL SPEED'
LEFT JOIN PartSubPropertiesValue p9 on p9.site=a.site and p9.PartNo=a.PartNo and p9.CodeNo='EXTRUSION' and p9.PropertiesItemNo='EXTRUSION POWER'
where a.ClosedFlag='N' and a.scheduleType='日计划派工单' and dbo.Get_WorkCenter_ProLineNo(a.site,a.S_WorkCenterNo)='EXTRUSIO' and b.status!='已关闭' and b.status!='已取消'
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,Round(dbo.Get_Part_NetWeight(b.Site,b.PartNo)*b.Qty/1000,2) weight
,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,dbo.get_expiredDate_print(b.Site,b.PartNo,b.BatchNo) expiredDate
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="getStockPrintListForReturn" 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,Round(dbo.Get_Part_NetWeight(b.Site,b.PartNo)*b.Qty/1000,2) weight
,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,dbo.get_expiredDate_print(b.Site,b.PartNo,b.BatchNo) expiredDate
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,Round(dbo.Get_Part_NetWeight(b.Site,b.PartNo)*b.Qty/1000,2) weight
,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,dbo.get_expiredDate_print(b.Site,b.PartNo,b.BatchNo) expiredDate
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="getStockPrintListHunlianReturn" 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,Round(dbo.Get_Part_NetWeight(b.Site,b.PartNo)*b.Qty/1000,2) weight
,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,dbo.get_expiredDate_print(b.Site,b.PartNo,b.BatchNo) expiredDate
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="getStockPrintListCaiGou" resultType="com.heai.modules.production.entity.StockPrintData">
Select D.TransNo,D.ItemNo,D.PartNo,dbo.Get_Part_DescSpec(D.Site,D.PartNo) as partDesc,dbo.Get_Part_UMID(D.Site,D.PartNo) as UMid
,D.Remark,D.OrderRef4 orderNo,T.EnterDate as TransDate,D.transQty qty,T.WarehouseID wareHouseId
,D.Site ,D.BatchNo,D.LocationID LocationId,D.site+'|'+ D.PartNo+'|'+T.WareHouseId+'|'+D.BatchNo+'|'+D.LocationId as seqNo
,dbo.Get_WareHouseDesc(T.Site,T.WarehouseID) as wareHouseDesc, dbo.get_expiredDate_print(D.Site,D.PartNo,D.BatchNo) ExpiredDate,p.id,p.printQty
,dbo.Get_StorePrintPartStatus(D.Site,D.PartNo,D.BatchNo) status,Round(dbo.Get_Part_NetWeight(D.Site,D.PartNo)*D.transQty/1000,2) weight
from TransDetail as D,TransHeader as t,print_info p
Where T.Site=D.Site and T.TransNo=D.TransNo
and D.Site=p.site and D.TransNo=p.orderref1
and D.ItemNo=p.orderref2 and p.status != 'Y' and p.LabelType='库存标签' and p.ComputerName =#{ip}
</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>
<update id="updatePrintFlag" >
update print_info set status = #{flag} where id=#{id}
</update>
<select id="getStockPrintOutBox" resultType="com.heai.modules.production.entity.PrintInfoData">
select id,batch_no,printer_name,status,orderref1,orderref2,remark,site,created_by,created_date,orderref3,printQty,ComputerName,
LabelType,UnitQty,KeyInfo_Int1,KeyInfo_Int2,KeyInfo_Str1,KeyInfo_Str2,KeyInfo_Float1,KeyInfo_Float2,SUBSTRING(LabelType, 5, 10) code from print_info
where status!='Y' and LabelType like '箱标签%' and ComputerName=#{ip}
</select>
<select id="checkPrintData" resultType="com.heai.modules.production.entity.PrintInfoData">
select id from print_info where status!='Y' and LabelType like #{type}+'%' and ComputerName=#{ip}
</select>
<select id="checkCaigouPrintData" resultType="com.heai.modules.production.entity.PrintInfoData">
select id from print_info where status!='Y' and LabelType like #{type}+'%' and ComputerName=#{ip}
</select>
<select id="getSiteDetail" resultType="String">
select REPLACE(Address_E+' Phone:'+PhoneNo+' Email:'+Email, CHAR(13) + CHAR(10), '') from site where SiteID=#{site}
</select>
<select id="getPackagePrintData" resultType="com.heai.modules.production.entity.PackagePrintData">
Select
T.Site,
T.OrderNo+'-'+Convert(Varchar(4),T.ItemNo) as TransNo,
T.SeqNo as ItemNo,
SO.PartNo,dbo.Get_PartDesc(T.Site,SO.PartNo) as PartDesc,
dbo.Get_Part_Spec(T.Site,SO.PartNo) as PartSpec,
dbo.Get_Part_UMID(T.Site,SO.PartNo) as umid ,
T.AssJobSeqNo as SeqNo,
T.Remark,CH.CustomerPONo as OrderRef4,
Convert(Datetime,Convert(Integer,Convert(Float,T.StatisticDate))) as ReceiveDate,
isnull((Select OurVendorCode from Customer as C Where C.Site=CH.Site and C.CustomerID=CH.CustomerID),'') as SiteName,
t.OrderNo as BatchNo,
T.OperatorID as Inspector,
s1.Address_E as siteAdress ,
'Phone:'+s1.PhoneNo+' Email:'+s1.Email as sitePhone,
convert(varchar(100),isnull(V.TextValue,'')) as bilNote,
pi.id,
pi.printQty,
pi.UnitQty,
SUBSTRING(LabelType, 5, 10) code,
pi.KeyInfo_Str1 as keyInfoStr1,
pi.KeyInfo_Str2 as keyInfoStr2
from SFDC as T
left join print_info pi on pi.Site=T.site and pi.status!='Y' and pi.orderRef1=T.OrderNo and pi.orderRef2=CONVERT(VARCHAR(10),T.ItemNo )
and pi.orderRef3=CONVERT(VARCHAR(10),T.SeqNo )
,ShopOrder as SO
Left Join COHeader as CH On CH.Site=SO.Site and CH.OrderNo=SO.OrderRef1
left join site s1 on s1.SiteID=SO.Site
,Part as P
Left Join PartSubPropertiesValue as V
On P.Site=V.Site and P.PartNo=V.PartNo and P.CodeNo=V.CodeNo and V.SubCodeSeqNo=1 and V.RecordType='P' and V.PropertiesItemNo='BILNOTE'
,Site as S
Where T.Site=S.SiteID and T.Site=SO.Site and T.OrderNo=SO.OrderNo
and SO.Site=P.Site and SO.PartNo=P.PartNo
AND pi.status='N' and pi.LabelType like '产品标签%' AND ComputerName=#{ip}
</select>
<select id="getJLPackagePrintData" resultType="com.heai.modules.production.entity.PackagePrintData">
Select
T.Site,
T.ReceiptNo+'-'+Convert(Varchar(4),T.ItemNo) as TransNo,
T.InspectItemNo as ItemNo,
PD.PartNo,dbo.Get_PartDesc(T.Site,PD.PartNo) as PartDesc,
dbo.Get_Part_Spec(T.Site,PD.PartNo) as PartSpec,
dbo.Get_Part_UMID(T.Site,PD.PartNo) as umid ,
T.InspectItemNo as SeqNo,
T.Remark,'' as OrderRef4,
Convert(Datetime,Convert(Integer,Convert(Float,T.InspectDate))) as ReceiveDate,
'' as SiteName,
PD.OrderNo as BatchNo,
T.Inspector as Inspector,
s.Address_E as siteAdress ,
'Phone:'+s.PhoneNo+' Email:'+s.Email as sitePhone,
convert(varchar(100),isnull(V.TextValue,'')) as bilNote,
pi.id,
pi.printQty,
pi.UnitQty,
SUBSTRING(LabelType, 5, 10) code,
pi.KeyInfo_Str1 as keyInfoStr1,
pi.KeyInfo_Str2 as keyInfoStr2
from POInspect as T
left join print_info pi on pi.Site=T.site and pi.status!='Y' and pi.orderRef1=T.ReceiptNo and pi.orderRef2=CONVERT(VARCHAR(10),T.ItemNo )
and pi.orderRef3=CONVERT(VARCHAR(10),T.InspectItemNo)
,POReceiptDetail as PD
,Part as P
Left Join PartSubPropertiesValue as V
On P.Site=V.Site and P.PartNo=V.PartNo and P.CodeNo=V.CodeNo and V.SubCodeSeqNo=1 and V.RecordType='P' and V.PropertiesItemNo='BILNOTE'
,Site as S
Where T.Site=S.SiteID and T.Site=PD.Site and T.ReceiptNo=PD.ReceiptNo and T.ItemNo=PD.ItemNo
and PD.Site=P.Site and PD.PartNo=P.PartNo
AND pi.status='N' and pi.LabelType like '进料产品标签%'
AND ComputerName=#{ip}
</select>
<select id="getSopAddress" resultType="com.heai.modules.production.entity.TvSopBaseData">
select tv_id,work_station,now_seqNo,now_operator,PartNo,RevNo,ItemNo,Site,colourFlag from tv_sop_base where tv_id=#{tvId}
</select>
<select id="getPictureList" resultType="com.heai.modules.pad.entity.AttachmentListData">
select AttaFileName_DB from AttachmentList where Site=#{site} and OrderRef1=#{partNo} and OrderRef2=#{revNo}
and OrderRef3=#{itemNo} and OrderRef4=#{type} and DelFlag='N'
</select>
<select id="searchBIBoardAddress" resultType="BIBoardAddressData">
select address from BIBoardAddress where reportId=#{reportId}
</select>
<select id="getPackagePrintDataList" resultType="com.heai.modules.production.entity.PackagePrintData">
Select
SO.PartNo,dbo.Get_PartDesc(T.Site,SO.PartNo) as PartDesc,
dbo.Get_Part_Spec(T.Site,SO.PartNo) as PartSpec,
dbo.Get_Part_UMID(T.Site,SO.PartNo) as umid ,T.WorkCenterNo,T.Site,
T.AssJobSeqNo as SeqNo,
T.Remark,CH.CustomerPONo as OrderRef4,
Convert(Datetime,Convert(Integer,Convert(Float,T.StatisticDate))) as ReceiveDate,
isnull((Select OurVendorCode from Customer as C Where C.Site=CH.Site and C.CustomerID=CH.CustomerID),'') as SiteName,
t.OrderNo as BatchNo,
T.OperatorID as Inspector,
s1.Address_E as siteAdress ,
'Phone:'+s1.PhoneNo+' Email:'+s1.Email as sitePhone,
1 as printQty,
<if test="number == null">
convert(float,dbo.Get_PartValue(T.Site,SO.PartNo,'QTY/BAG')) as unitQty,
</if>
convert(varchar(100),isnull(V.TextValue,'')) as bilNote
from SFDC as T
,ShopOrder as SO
Left Join COHeader as CH On CH.Site=SO.Site and CH.OrderNo=SO.OrderRef1
left join site s1 on s1.SiteID=SO.Site,Part as P
Left Join PartSubPropertiesValue as V
On P.Site=V.Site and P.PartNo=V.PartNo and P.CodeNo=V.CodeNo and V.SubCodeSeqNo=1 and V.RecordType='P' and V.PropertiesItemNo='BILNOTE'
,Site as S
Where T.Site=S.SiteID and T.Site=SO.Site and T.OrderNo=SO.OrderNo
and SO.Site=P.Site and SO.PartNo=P.PartNo and t.AssJobSeqNo = #{seqNo,jdbcType=INTEGER}
</select>
<select id="getCustomerInfo" resultType="java.util.HashMap">
Select isnull((Select C.CustomerGroup from Customer as C Where C.Site=CH.Site and C.CustomerID=CH.CustomerID),'') as CustomerGroup,
isnull((Select C.ABC from Customer as C Where C.Site=CH.Site and C.CustomerID=CH.CustomerID),'') as ABC,
isnull((Select C.ShortCustomerName from Customer as C Where C.Site=CH.Site and C.CustomerID=CH.CustomerID),'') as CustomerDesc,
isnull((Select C.LogoFileName from Customer as C Where C.Site=CH.Site and C.CustomerID=CH.CustomerID),'') as LogoFileName
from ShopOrder as SO
Left Join COHeader as CH On CH.Site=SO.Site and CH.OrderNo=SO.OrderRef1
Where SO.Site = #{site} and SO.OrderNo = #{orderNo}
</select>
<select id="getWorkCenterProLineNo" resultType="java.lang.String">
select dbo.Get_WorkCenter_ProLineNo(#{site},#{workCenterNo})
</select>
<select id="getPartValue" resultType="java.math.BigDecimal">
select convert(float,dbo.Get_PartValue(#{site},#{partNo},'QTY/BAG'))
</select>
<select id="getPrintLabelRecordById" resultType="com.heai.modules.production.entity.PrintLabelRecord">
select * from print_label_record where id = #{id}
</select>
</mapper>