|
@@ -81,14 +81,14 @@
|
|
|
and (c.cInvCCode LIKE '01%'
|
|
|
or c.cInvCCode LIKE '02%'
|
|
|
or c.cInvCCode LIKE '03%'
|
|
|
- or c.cInvCCode LIKE '04%')
|
|
|
+ or c.cInvCCode LIKE '04%') and c.cInvCCode not in ('0299','0399','0499')
|
|
|
) as t1 group by cVenName,cVenAbbName,cPOID,cInvCode,cInvName,cColor<!--,cBatch-->
|
|
|
</select>
|
|
|
<!-- 其他入库纱,找委外订单的材料出库单,获取物料号+批号,物料号+批号再其他入库单 -->
|
|
|
<select id="getPurchaseListOtherInList" resultType="org.jeecg.modules.report.entity.FabricPoOrderOut">
|
|
|
(
|
|
|
SELECT
|
|
|
- a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,
|
|
|
+ a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,d.cInvName,a.cInvCode,isnull(a.cFree1,'') as cColor,
|
|
|
isnull(isnull(stuff((SELECT ',' + x.cdefine9 FROM rdrecord08 x
|
|
|
inner join RdRecords08 y on x.id=y.id
|
|
|
where y.cInvCode + isnull( y.cFree1, '' ) + isnull( y.cBatch, '' )=
|
|
@@ -109,10 +109,20 @@
|
|
|
WHERE
|
|
|
a.cbustype = '其他入库'
|
|
|
) and
|
|
|
+ a.cInvCode + isnull( a.cFree1, '' ) + isnull( a.cBatch, '' ) not IN (
|
|
|
+ SELECT
|
|
|
+ u.cInvCode + isnull( u.cFree1, '' ) + isnull( u.cBatch, '' )
|
|
|
+ FROM
|
|
|
+ rdrecords01 u
|
|
|
+ inner join RdRecord01 v on u.id=v.id
|
|
|
+ inner join OM_MODetails w on u.iOMoDID =w.MODetailsID
|
|
|
+ inner join om_momain x on w.moid =x.moid
|
|
|
+ where x.cCode like CONCAT(#{code},'%')
|
|
|
+ ) and
|
|
|
d.cinvname <> '杂纱' and a.iquantity>0
|
|
|
) union all (
|
|
|
SELECT
|
|
|
- a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,
|
|
|
+ a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,d.cInvName,a.cInvCode,isnull(a.cFree1,'') as cColor,
|
|
|
isnull(isnull(stuff((SELECT ',' + x.cdefine9 FROM rdrecord08 x
|
|
|
inner join RdRecords08 y on x.id=y.id
|
|
|
where y.cInvCode + isnull( y.cFree1, '' ) + isnull( y.cBatch, '' ) in (
|
|
@@ -146,10 +156,20 @@
|
|
|
WHERE
|
|
|
a.cbustype = '其他入库'
|
|
|
) and
|
|
|
+ a.cInvCode + isnull( a.cFree1, '' ) + isnull( a.cBatch, '' ) not IN (
|
|
|
+ SELECT
|
|
|
+ u.cInvCode + isnull( u.cFree1, '' ) + isnull( u.cBatch, '' )
|
|
|
+ FROM
|
|
|
+ rdrecords01 u
|
|
|
+ inner join RdRecord01 v on u.id=v.id
|
|
|
+ inner join OM_MODetails w on u.iOMoDID =w.MODetailsID
|
|
|
+ inner join om_momain x on w.moid =x.moid
|
|
|
+ where x.cCode like CONCAT(#{code},'%')
|
|
|
+ ) and
|
|
|
d.cinvname <> '杂纱' and a.iquantity>0
|
|
|
) union all (
|
|
|
SELECT
|
|
|
- a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,'杂纱' as cPlanCode
|
|
|
+ a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,d.cInvName,a.cInvCode,isnull(a.cFree1,'') as cColor,'杂纱' as cPlanCode
|
|
|
FROM
|
|
|
rdrecords11 a
|
|
|
INNER JOIN Inventory d ON a.cinvcode = d.cinvcode
|
|
@@ -165,7 +185,7 @@
|
|
|
(
|
|
|
SELECT
|
|
|
a.comcode as cCode,case when a.iSQuantity is null or a.iSQuantity=0 then a.iquantity else a.iSQuantity end as iQuantity,
|
|
|
- isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,a.cInvCode,isnull(a.cFree1,'') as cColor,
|
|
|
+ isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,a.cInvCode,isnull(a.cFree1,'') as cColor,d.cInvName,
|
|
|
case when a.cBatch is not null and a.cBatch='期初' then '期初'
|
|
|
else
|
|
|
isnull(stuff((
|
|
@@ -205,7 +225,7 @@
|
|
|
) union all (
|
|
|
SELECT
|
|
|
a.comcode as cCode,case when a.iSQuantity is null or a.iSQuantity=0 then a.iquantity else a.iSQuantity end as iQuantity,
|
|
|
- isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,a.cInvCode,isnull(a.cFree1,'') as cColor,
|
|
|
+ isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,a.cInvCode,isnull(a.cFree1,'') as cColor,d.cInvName,
|
|
|
case when a.cBatch is not null and a.cBatch='期初' then '期初'
|
|
|
else
|
|
|
isnull(stuff((
|
|
@@ -251,7 +271,7 @@
|
|
|
</select>
|
|
|
<!--获取所有委外订单 cComUnitCode : 计量单位,02(PCS)根,04(M)米-->
|
|
|
<select id="getOmOrderListAll" resultType="org.jeecg.modules.report.entity.FabricOMOrder">
|
|
|
- select cVCName,cVenName ,cVenAbbName ,cVenCode ,cInvCode,cInvName,cComUnitCode,cColor,
|
|
|
+ select cVCName,cVenName ,cVenAbbName ,cVenCode ,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor,
|
|
|
isnull(sum(iQuantityOut),0) as iQuantityOut,
|
|
|
isnull(sum(iQuantity),0) as iQuantity,
|
|
|
isnull(sum(iQuantityIn),0) as iQuantityIn
|
|
@@ -260,7 +280,7 @@
|
|
|
SELECT e.cVCName,d.cVenName ,d.cVenAbbName ,a.cVenCode ,c.cInvCode,c.cInvName,c.cComUnitCode,b.cFree1 as cColor,
|
|
|
(select sum(iQuantity) from rdrecords11 x where x.iOMoDID=b.MODetailsID) as iQuantityOut,
|
|
|
(select sum(iQuantity) from RdRecords01 x where x.iOMoDID=b.MODetailsID) as iQuantityIn,
|
|
|
- b.iQuantity,b.MODetailsID
|
|
|
+ b.iQuantity,b.MODetailsID,isnull(b.cdefine30,'') as cColorNumber
|
|
|
FROM
|
|
|
om_momain a
|
|
|
INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
@@ -271,13 +291,13 @@
|
|
|
c.cInvCCode NOT LIKE '19%'
|
|
|
AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
|
|
|
- ) as t1 group by cVCName,cVenName,cVenAbbName,cVenCode,cInvCode,cInvName,cComUnitCode,cColor
|
|
|
- order by cVCName,cVenName,cInvCode,cInvName,cComUnitCode,cColor
|
|
|
+ ) as t1 group by cVCName,cVenName,cVenAbbName,cVenCode,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor
|
|
|
+ order by cVCName,cVenName,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor
|
|
|
|
|
|
</select>
|
|
|
<!--获取销售出库委外订单:物料+颜色在销售出库表中,cComUnitCode : 计量单位,02(PCS)根,04(M)米-->
|
|
|
<select id="getOmOrderListGw" resultType="org.jeecg.modules.report.entity.FabricOMOrder">
|
|
|
- select cVCName,cVenName ,cVenAbbName ,cVenCode ,cInvCode,cInvName,cComUnitCode,cColor,
|
|
|
+ select cVCName,cVenName ,cVenAbbName ,cVenCode ,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor,
|
|
|
isnull(sum(iQuantityOut),0) as iQuantityOut,
|
|
|
isnull(sum(iQuantity),0) as iQuantity,
|
|
|
isnull(sum(iQuantityIn),0) as iQuantityIn
|
|
@@ -286,7 +306,7 @@
|
|
|
SELECT e.cVCName,d.cVenName ,d.cVenAbbName ,a.cVenCode ,c.cInvCode,c.cInvName,c.cComUnitCode,b.cFree1 as cColor,
|
|
|
(select sum(iQuantity) from rdrecords11 x where x.iOMoDID=b.MODetailsID) as iQuantityOut,
|
|
|
(select sum(iQuantity) from RdRecords01 x where x.iOMoDID=b.MODetailsID) as iQuantityIn,
|
|
|
- b.iQuantity,b.MODetailsID
|
|
|
+ b.iQuantity,b.MODetailsID,isnull(b.cdefine30,'') as cColorNumber
|
|
|
FROM
|
|
|
om_momain a
|
|
|
INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
@@ -299,8 +319,8 @@
|
|
|
and b.cInvCode+isnull(b.cFree1,'') in (
|
|
|
select cInvCode+isnull(cFree1,'') from rdrecords32 where cbatch like CONCAT(#{code},'%')
|
|
|
)
|
|
|
- ) as t1 group by cVCName,cVenName,cVenAbbName,cVenCode,cInvCode,cInvName,cComUnitCode,cColor
|
|
|
- order by cVCName,cVenName,cInvCode,cInvName,cComUnitCode,cColor
|
|
|
+ ) as t1 group by cVCName,cVenName,cVenAbbName,cVenCode,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor
|
|
|
+ order by cVCName,cVenName,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor
|
|
|
|
|
|
</select>
|
|
|
<!--获取本次采购入库的委外材料出库单,已核销的取核销数量-->
|
|
@@ -844,4 +864,16 @@
|
|
|
</foreach>
|
|
|
|
|
|
</select>
|
|
|
+ <!-- 获取事故单 -->
|
|
|
+ <select id="getAccidentList" resultType="org.jeecg.modules.report.entity.FabricAccident">
|
|
|
+ SELECT ah.cPBVCode,VEN.cVenAbbName,sum(A.iOriSum) as iOriSum
|
|
|
+ from PurBillVouchs a
|
|
|
+ left join PurBillVouch ah on ah.pbvid=a.pbvid
|
|
|
+ left join Inventory inv on inv.cInvCode=a.cInvCode
|
|
|
+ left join Vendor ven on ven.cVenCode=ah.cvencode
|
|
|
+ where cPBVBillType='03'
|
|
|
+ and inv.cInvName='事故单' and ah.cDefine2 like CONCAT(#{code},'%')
|
|
|
+ group by ah.cPBVCode,VEN.cVenAbbName
|
|
|
+
|
|
|
+ </select>
|
|
|
</mapper>
|