|
|
|
@ -216,38 +216,42 @@ |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="queryPartInventory" resultType="com.heai.modules.board.entity.Inventory"> |
|
|
|
Select T.Site, |
|
|
|
T.PartNo, |
|
|
|
P.PartDescription, |
|
|
|
P.Spec, |
|
|
|
T.WarehouseID, |
|
|
|
P.UMID, |
|
|
|
T.LocationID, |
|
|
|
T.BatchNo, |
|
|
|
T.FirstInDate, |
|
|
|
T.LatestCountDate, |
|
|
|
T.Freezeflag, |
|
|
|
P.PartType, |
|
|
|
P.FamilyID, |
|
|
|
dbo.Get_PartFamilyDesc(P.Site, P.FamilyID) as FamilyName, |
|
|
|
P.GroupID, |
|
|
|
dbo.Get_PartGroupDesc(T.Site, P.GroupID) as PartGroup, |
|
|
|
T.LatestOutDate, |
|
|
|
T.LatestInDate, |
|
|
|
T.ActiveDate, |
|
|
|
T.PartnerID, |
|
|
|
T.PartnerType, |
|
|
|
T.ManufactureDate, |
|
|
|
T.ExpiredDate, |
|
|
|
sum(Round(T.QtyOnHand, 3)) as QtyOnHand, |
|
|
|
sum(Round(isnull(T.QtyReserved, 0), 3)) as QtyReserved, |
|
|
|
sum(Round(isnull(T.InStandardValue, 0), 4) - |
|
|
|
Round(isnull(T.OutStandardValue, 0), 4)) as StandartStockValue, |
|
|
|
sum(Round(isnull(T.InActualValue, 0), 4) - |
|
|
|
Round(isnull(T.OutActualValue, 0), 4)) as ActualStockValue, |
|
|
|
T.DemandPartnerType, |
|
|
|
T.DemandPartnerID, |
|
|
|
T.DemandPartnerName |
|
|
|
Select T.Site, |
|
|
|
T.PartNo, |
|
|
|
P.PartDescription, |
|
|
|
P.Spec, |
|
|
|
<if test="summaryType != null and summaryType >= 1"> |
|
|
|
T.WarehouseID, |
|
|
|
</if> |
|
|
|
P.UMID, |
|
|
|
<if test="summaryType != null and summaryType >= 2"> |
|
|
|
T.LocationID, |
|
|
|
</if> |
|
|
|
<if test="summaryType != null and summaryType >= 3"> |
|
|
|
T.BatchNo, |
|
|
|
</if> |
|
|
|
min(T.FirstInDate) as FirstInDate, |
|
|
|
max(T.LatestCountDate) as LatestCountDate, |
|
|
|
min(T.Freezeflag) as Freezeflag, |
|
|
|
P.PartType, |
|
|
|
P.FamilyID, |
|
|
|
dbo.Get_PartFamilyDesc(P.Site, P.FamilyID) as FamilyName, |
|
|
|
P.GroupID, |
|
|
|
dbo.Get_PartGroupDesc(T.Site, P.GroupID) as PartGroup, |
|
|
|
max(T.LatestOutDate) as LatestOutDate, |
|
|
|
max(T.LatestInDate) as LatestInDate, |
|
|
|
max(T.ActiveDate) as ActiveDate, |
|
|
|
max(T.PartnerID) as PartnerID, |
|
|
|
max(T.PartnerType) as PartnerType, |
|
|
|
min(T.ManufactureDate) as ManufactureDate, |
|
|
|
max(T.ExpiredDate) as ExpiredDate, |
|
|
|
sum(Round(T.QtyOnHand, 3)) as QtyOnHand, |
|
|
|
sum(Round(isnull(T.QtyReserved, 0), 3)) as QtyReserved, |
|
|
|
sum(Round(isnull(T.InStandardValue, 0), 4) - Round(isnull(T.OutStandardValue, 0), 4)) as StandartStockValue, |
|
|
|
sum(Round(isnull(T.InActualValue, 0), 4) - Round(isnull(T.OutActualValue, 0), 4)) as ActualStockValue, |
|
|
|
max(T.DemandPartnerType) as DemandPartnerType, |
|
|
|
max(T.DemandPartnerID) as DemandPartnerID, |
|
|
|
max(T.DemandPartnerName) as DemandPartnerName |
|
|
|
from InventoryStock as T, |
|
|
|
Part as P |
|
|
|
where T.Site = P.Site |
|
|
|
@ -265,24 +269,55 @@ |
|
|
|
<if test="site != null and site != ''"> |
|
|
|
and T.Site = #{site} |
|
|
|
</if> |
|
|
|
<if test="partType != null and partType != ''"> |
|
|
|
and P.PartType like #{partType} |
|
|
|
</if> |
|
|
|
<if test="warehouseId != null and warehouseId != ''"> |
|
|
|
and T.WarehouseID = #{warehouseId} |
|
|
|
</if> |
|
|
|
<if test="locationId != null and locationId != ''"> |
|
|
|
<if test="locationId != null and locationId != '' and summaryType != null and summaryType >= 2"> |
|
|
|
and T.LocationID = #{locationId} |
|
|
|
</if> |
|
|
|
<if test="batchNo != null and batchNo != ''"> |
|
|
|
<if test="batchNo != null and batchNo != '' and summaryType != null and summaryType >= 3"> |
|
|
|
and T.BatchNo = #{batchNo} |
|
|
|
</if> |
|
|
|
<if test="finalStartDate != null"> |
|
|
|
and T.FirstInDate > #{finalStartDate} |
|
|
|
<if test="familyId != null and familyId != ''"> |
|
|
|
and P.FamilyID like #{familyId} |
|
|
|
</if> |
|
|
|
<if test="familyName != null and familyName != ''"> |
|
|
|
and dbo.Get_PartFamilyDesc(P.Site, P.FamilyID) like #{familyName} |
|
|
|
</if> |
|
|
|
<if test="startFirstInDate != null"> |
|
|
|
and T.FirstInDate >= #{startFirstInDate} |
|
|
|
</if> |
|
|
|
<if test="finalEndDate != null"> |
|
|
|
and #{finalEndDate} > T.FirstInDate |
|
|
|
<if test="endFirstInDate != null"> |
|
|
|
and #{endFirstInDate} >= T.FirstInDate |
|
|
|
</if> |
|
|
|
group by T.Site, T.PartNo, P.PartDescription, P.Spec, T.WarehouseID, P.UMID, T.LocationID, T.BatchNo, |
|
|
|
T.FirstInDate, T.LatestCountDate, T.Freezeflag, P.PartType, P.FamilyID, P.Site, P.FamilyID, P.GroupID, |
|
|
|
T.Site, P.GroupID, T.LatestOutDate, T.LatestInDate, T.ActiveDate, T.PartnerID, T.PartnerType, |
|
|
|
T.ManufactureDate, T.ExpiredDate, T.DemandPartnerType, T.DemandPartnerID, T.DemandPartnerName |
|
|
|
<if test="startExpiredDate != null"> |
|
|
|
and T.ExpiredDate >= #{startExpiredDate} |
|
|
|
</if> |
|
|
|
<if test="endExpiredDate != null"> |
|
|
|
and #{endExpiredDate} >= T.ExpiredDate |
|
|
|
</if> |
|
|
|
group by |
|
|
|
T.Site, |
|
|
|
T.PartNo, |
|
|
|
P.PartDescription, |
|
|
|
P.Spec, |
|
|
|
<if test="summaryType != null and summaryType >= 1"> |
|
|
|
T.WarehouseID, |
|
|
|
</if> |
|
|
|
P.UMID, |
|
|
|
<if test="summaryType != null and summaryType >= 2"> |
|
|
|
T.LocationID, |
|
|
|
</if> |
|
|
|
<if test="summaryType != null and summaryType >= 3"> |
|
|
|
T.BatchNo, |
|
|
|
</if> |
|
|
|
P.Site, |
|
|
|
P.FamilyID, |
|
|
|
P.GroupID, |
|
|
|
P.PartType |
|
|
|
</select> |
|
|
|
|
|
|
|
</mapper> |