|
@@ -289,6 +289,46 @@
|
|
|
</select>-->
|
|
|
<!--获取所有委外订单 cComUnitCode : 计量单位,02(PCS)根,04(M)米-->
|
|
|
<select id="getOmOrderListAll" resultType="org.jeecg.modules.report.entity.FabricOMOrder">
|
|
|
+ select MODetailsID,cVCName,cVenName,cVenAbbName,cVenCode,cInvCode,cInvName,cComUnitCode,cColor,cColorNumber,
|
|
|
+ sum(iQuantityOut) as iQuantityOut,sum(iQuantityIn) as iQuantityIn,sum(iQuantity) as iQuantity from (
|
|
|
+ (
|
|
|
+ SELECT b.MODetailsID,e.cVCName,d.cVenName ,d.cVenAbbName ,a.cVenCode ,c.cInvCode,c.cInvName,c.cComUnitCode,
|
|
|
+ isnull(b.cFree1,'') as cColor,
|
|
|
+ isnull((select sum(x.iQuantity-isnull(x.iSQuantity,0)) from rdrecords11 x where x.iOMoDID=b.MODetailsID),0) as iQuantityOut,
|
|
|
+ isnull((select sum(iQuantity) from RdRecords01 x where x.iOMoDID=b.MODetailsID),0) as iQuantityIn,
|
|
|
+ b.iQuantity,isnull(b.cdefine30,'') as cColorNumber
|
|
|
+ FROM
|
|
|
+ om_momain a
|
|
|
+ INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
|
+ INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
+ inner join Vendor d on a.cVenCode=d.cVenCode
|
|
|
+ inner join VendorClass e on d.cVCCode =e.cVCCode
|
|
|
+ WHERE
|
|
|
+ c.cInvCCode NOT LIKE '19%'
|
|
|
+ AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
+ ) union all (
|
|
|
+ SELECT b.MODetailsID,e.cVCName,d.cVenName ,d.cVenAbbName ,a.cVenCode ,c.cInvCode,c.cInvName,c.cComUnitCode,
|
|
|
+ isnull(b.cFree1,'') as cColor,
|
|
|
+ g.iQuantity as iQuantityOut,
|
|
|
+ 0 as iQuantityIn,
|
|
|
+ 0 as iQuantity,isnull(b.cdefine30,'') as cColorNumber
|
|
|
+ FROM
|
|
|
+ om_momain a
|
|
|
+ INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
|
+ inner join RdRecords01 f on b.MODetailsID=f.iOMoDID
|
|
|
+ inner join VIEW_OM_SETTLEVOUCE g on f.autoid=g.inId
|
|
|
+ INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
+ inner join Vendor d on a.cVenCode=d.cVenCode
|
|
|
+ inner join VendorClass e on d.cVCCode =e.cVCCode
|
|
|
+ inner join Inventory h on h.cinvcode=g.cinvcode
|
|
|
+ WHERE
|
|
|
+ c.cInvCCode NOT LIKE '19%'
|
|
|
+ AND a.cCode LIKE CONCAT(#{code},'%') and g.cMoCode LIKE CONCAT(#{code},'%')
|
|
|
+ )) as t1
|
|
|
+ group by MODetailsID,cVCName,cVenName,cVenAbbName,cVenCode,cInvCode,cInvName,cComUnitCode,cColor,cColorNumber
|
|
|
+ having (sum(iQuantityOut)>0 or sum(iQuantityIn)>0)
|
|
|
+ order by cVCName,cVenName,cInvCode,cInvName,cComUnitCode,cColor,cColorNumber
|
|
|
+<!--
|
|
|
select * from (
|
|
|
SELECT b.MODetailsID,e.cVCName,d.cVenName ,d.cVenAbbName ,a.cVenCode ,c.cInvCode,c.cInvName,c.cComUnitCode,
|
|
|
isnull(b.cFree1,'') as cColor,
|
|
@@ -307,24 +347,6 @@
|
|
|
c.cInvCCode NOT LIKE '19%'
|
|
|
AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
) as t1 where (iQuantityOut>0 or iQuantityIn>0)
|
|
|
- order by cVCName,cVenName,cInvCode,cInvName,cComUnitCode,cColor,cColorNumber
|
|
|
-<!--
|
|
|
- select * from (
|
|
|
- SELECT b.MODetailsID,e.cVCName,d.cVenName ,d.cVenAbbName ,a.cVenCode ,c.cInvCode,c.cInvName,c.cComUnitCode,
|
|
|
- isnull(b.cFree1,'') as cColor,
|
|
|
- isnull((select sum(iQuantity) from rdrecords11 x where x.iOMoDID=b.MODetailsID),0) as iQuantityOut,
|
|
|
- isnull((select sum(iQuantity) from RdRecords01 x where x.iOMoDID=b.MODetailsID),0) as iQuantityIn,
|
|
|
- b.iQuantity,isnull(b.cdefine30,'') as cColorNumber
|
|
|
- FROM
|
|
|
- om_momain a
|
|
|
- INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
|
- INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
- inner join Vendor d on a.cVenCode=d.cVenCode
|
|
|
- inner join VendorClass e on d.cVCCode =e.cVCCode
|
|
|
- WHERE
|
|
|
- c.cInvCCode NOT LIKE '19%'
|
|
|
- AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
- ) as t1 where (iQuantityOut>0 or iQuantityIn>0)
|
|
|
order by cVCName,cVenName,cInvCode,cInvName,cComUnitCode,cColor,cColorNumber-->
|
|
|
|
|
|
</select>
|
|
@@ -685,11 +707,48 @@
|
|
|
</select>-->
|
|
|
<!-- 获取委外订单行id,出库物料信息,出库数量 -->
|
|
|
<select id="getOmRowOutList" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
|
|
|
+ select MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut,cOmCode,cOmVenAbbName,sum(iQuantityOut) as iQuantityOut from
|
|
|
+ ((
|
|
|
+ select b.MODetailsID,
|
|
|
+ d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cFree1,'') as cColorOut,
|
|
|
+ isnull(d.cBatch,'') as cBatchOut,
|
|
|
+ d.iQuantity-isnull(d.iSQuantity,0) as iQuantityOut,
|
|
|
+ z.cInvCCode as cInvCCodeOut,a.cCode as cOmCode,x.cVenAbbName as cOmVenAbbName
|
|
|
+ FROM
|
|
|
+ om_momain a
|
|
|
+ INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
|
+ INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
+ inner join rdrecords11 d on d.iOMoDID=b.MODetailsID
|
|
|
+ INNER JOIN Inventory z ON d.cinvcode = z.cinvcode
|
|
|
+ inner join Vendor x on x.cVenCode=a.cVenCode
|
|
|
+ WHERE
|
|
|
+ c.cInvCCode NOT LIKE '19%'
|
|
|
+ AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
+ ) union all (
|
|
|
+ select b.MODetailsID,
|
|
|
+ g.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(g.cColor,'') as cColorOut,
|
|
|
+ isnull(g.cBatch,'') as cBatchOut,
|
|
|
+ g.iQuantity as iQuantityOut,
|
|
|
+ z.cInvCCode as cInvCCodeOut,a.cCode as cOmCode,x.cVenAbbName as cOmVenAbbName
|
|
|
+ FROM
|
|
|
+ om_momain a
|
|
|
+ INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
|
+ INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
+ inner join RdRecords01 f on b.MODetailsID=f.iOMoDID
|
|
|
+ inner join VIEW_OM_SETTLEVOUCE g on f.autoid=g.inId
|
|
|
+ INNER JOIN Inventory z ON g.cinvcode = z.cinvcode
|
|
|
+ inner join Vendor x on x.cVenCode=a.cVenCode
|
|
|
+ WHERE
|
|
|
+ c.cInvCCode NOT LIKE '19%'
|
|
|
+ AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
+ )) as t1
|
|
|
+ group by MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut,cOmCode,cOmVenAbbName
|
|
|
+<!--
|
|
|
select b.MODetailsID,
|
|
|
d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cFree1,'') as cColorOut,
|
|
|
isnull(d.cBatch,'') as cBatchOut,
|
|
|
isnull(sum(d.iQuantity-d.iSQuantity+isnull(y.iQuantity,0)),0) as iQuantityOut,
|
|
|
- c.cInvCCode as cInvCCodeOut,a.cCode as cOmCode,x.cVenAbbName as cOmVenAbbName
|
|
|
+ z.cInvCCode as cInvCCodeOut,a.cCode as cOmCode,x.cVenAbbName as cOmVenAbbName
|
|
|
FROM
|
|
|
om_momain a
|
|
|
INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
@@ -697,13 +756,13 @@
|
|
|
inner join rdrecords11 d on d.iOMoDID=b.MODetailsID
|
|
|
INNER JOIN Inventory z ON d.cinvcode = z.cinvcode
|
|
|
inner join Vendor x on x.cVenCode=a.cVenCode
|
|
|
- left join VIEW_OM_OUT_SETTLEVOUCE y on d.autoid=y.iRdsID
|
|
|
+ left outer join VIEW_OM_OUT_SETTLEVOUCE y on d.autoid=y.iRdsID
|
|
|
WHERE
|
|
|
c.cInvCCode NOT LIKE '19%'
|
|
|
AND a.cCode LIKE CONCAT(#{code},'%')
|
|
|
- AND y.cmocode LIKE CONCAT(#{code},'%')
|
|
|
+ AND (y.cmocode is null or y.cmocode LIKE CONCAT(#{code},'%'))
|
|
|
group by b.MODetailsID,
|
|
|
- d.cInvCode,z.cInvName,d.cFree1,d.cBatch,c.cInvCCode,a.cCode,x.cVenAbbName
|
|
|
+ d.cInvCode,z.cInvName,d.cFree1,d.cBatch,z.cInvCCode,a.cCode,x.cVenAbbName-->
|
|
|
</select>
|
|
|
<!-- 获取委外订单出库物料的入库物料信息:包含采购入库、委外入库 -->
|
|
|
<!--
|
|
@@ -901,6 +960,7 @@
|
|
|
|
|
|
</select>
|
|
|
<!-- 获取委外订单国外出库数量 -->
|
|
|
+ <!--
|
|
|
<select id="getOmInGwOutList" resultType="org.jeecg.modules.report.entity.FabricPoOrderOut">
|
|
|
select b.cInvCode,isnull(b.cFree1,'') as cColor,isnull(b.cBatch,'') as cBatch,b.iQuantity from rdrecord32 a inner join rdrecords32 b
|
|
|
on a.id=b.id
|
|
@@ -909,7 +969,7 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
|
|
|
- </select>
|
|
|
+ </select>-->
|
|
|
<!-- 获取事故单 -->
|
|
|
<select id="getAccidentList" resultType="org.jeecg.modules.report.entity.FabricAccident">
|
|
|
SELECT ah.cPBVMemo,ah.cPBVCode,VEN.cVenAbbName,sum(A.iOriSum) as iOriSum
|
|
@@ -922,41 +982,6 @@
|
|
|
group by ah.cPBVMemo,ah.cPBVCode,VEN.cVenAbbName
|
|
|
|
|
|
</select>
|
|
|
- <!-- 获取形态转换入库的原始入库单,可能存在多次形态转换,需要多次调用 -->
|
|
|
- <!--
|
|
|
- <select id="getOrgInList" resultType="org.jeecg.modules.report.entity.FabricCommonIn">
|
|
|
-
|
|
|
- (
|
|
|
- select b.AutoId,a.cBusType,b.cInvCode+isnull(b.cFree1,'')+isnull(b.cBatch,'') as cInvIdBefore,b.iQuantity,
|
|
|
- case when a.cbustype='委外加工' then 0 else
|
|
|
- isnull(isnull((select sum(iSum) from PurBillVouchs x where x.RdsId =b.autoid),iSum ),0)
|
|
|
- end as iPurchuseMoney,
|
|
|
- c.cInvCode2+c.cColor2+c.cAVBatch2 as cInvIdAfter,b.cPOID as cCode,isnull(b.iOMoDID,0) as iOMoDID,
|
|
|
- d.cVenName,d.cVenAbbName,e.cVCName
|
|
|
- from VIEW_FabricLoss_AssemVouchs c,rdrecords01 b,rdrecord01 a,Vendor d, VendorClass e
|
|
|
- where a.id=b.id and d.cVenCode=a.cVenCode and d.cVCCode =e.cVCCode
|
|
|
- and c.cinvcode+ccolor+cavbatch=b.cinvcode +isnull(b.cFree1,'')+isnull(b.cBatch,'') and b.iQuantity <> 0
|
|
|
- and c.cInvCode2+c.cColor2+c.cAVBatch2 in
|
|
|
- <foreach item="item" collection="invIdList" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- ) union all (
|
|
|
- select b.AutoId,a.cBusType,b.cInvCode+isnull(b.cFree1,'')+isnull(b.cBatch,'') as cInvIdBefore,b.iQuantity,
|
|
|
- isnull(case when a.cMaker='王行乔' then b.iPrice else b.iPrice*1.13 end,0) as iPurchuseMoney,
|
|
|
- c.cInvCode2+c.cColor2+c.cAVBatch2 as cInvIdAfter,'' as cCode,0 as iOMoDID
|
|
|
- '' as cVenName,'' as cVenAbbName,'' as cVCName
|
|
|
- from VIEW_FabricLoss_AssemVouchs c,rdrecords08 b,rdrecord08 a
|
|
|
- where a.id=b.id
|
|
|
- and c.cinvcode+ccolor+cavbatch=b.cinvcode +isnull(b.cFree1,'')+isnull(b.cBatch,'') and a.cbustype <> '调拨入库'
|
|
|
- and b.iQuantity <> 0
|
|
|
- and c.cInvCode2+c.cColor2+c.cAVBatch2 in
|
|
|
- <foreach item="item" collection="invIdList" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- )
|
|
|
-
|
|
|
-
|
|
|
- </select>-->
|
|
|
<!-- 获取形态转换物料的原始入库单 -->
|
|
|
<select id="getAssemVouchsOrgInList" resultType="org.jeecg.modules.report.entity.FabricAssemVouchsOrgIn">
|
|
|
|
|
@@ -1091,21 +1116,65 @@
|
|
|
</select>
|
|
|
<!-- 根据委外订单子表id获取委外出库信息,用于计算其他委外订单 -->
|
|
|
<select id="getOmRowOutListByDetailId" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
|
|
|
+ select MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut,sum(iQuantityOut) as iQuantityOut from
|
|
|
+ ((
|
|
|
+ select b.MODetailsID,
|
|
|
+ d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cFree1,'') as cColorOut,
|
|
|
+ isnull(d.cBatch,'') as cBatchOut,
|
|
|
+ d.iQuantity-isnull(d.iSQuantity,0) as iQuantityOut,
|
|
|
+ z.cInvCCode as cInvCCodeOut
|
|
|
+ FROM
|
|
|
+ om_momain a
|
|
|
+ inner join OM_MODetails b on a.moid = b.moid
|
|
|
+ INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
+ inner join rdrecords11 d on d.iOMoDID=b.MODetailsID
|
|
|
+ INNER JOIN Inventory z ON d.cinvcode = z.cinvcode
|
|
|
+ WHERE
|
|
|
+ b.MODetailsID in
|
|
|
+ <foreach item="item" collection="detailIdList" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ ) union all (
|
|
|
+ select b.MODetailsID,
|
|
|
+ d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cColor,'') as cColorOut,
|
|
|
+ isnull(d.cBatch,'') as cBatchOut,
|
|
|
+ d.iQuantity as iQuantityOut,
|
|
|
+ z.cInvCCode as cInvCCodeOut
|
|
|
+ FROM
|
|
|
+ om_momain a
|
|
|
+ inner join OM_MODetails b on a.moid = b.moid
|
|
|
+ INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
+ inner join RdRecords01 f on b.MODetailsID=f.iOMoDID
|
|
|
+ inner join VIEW_OM_SETTLEVOUCE d on f.autoid=d.inId
|
|
|
+ INNER JOIN Inventory z ON d.cinvcode = z.cinvcode
|
|
|
+ WHERE
|
|
|
+ b.MODetailsID in
|
|
|
+ <foreach item="item" collection="detailIdList" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ ) as t1
|
|
|
+ group by MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut
|
|
|
+<!--
|
|
|
select b.MODetailsID,
|
|
|
- d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cFree1,'') as cColorOut,
|
|
|
- isnull(d.cBatch,'') as cBatchOut,
|
|
|
- isnull(sum(d.iQuantity),0) as iQuantityOut,z.cInvCCode as cInvCCodeOut
|
|
|
+ d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cFree1,'') as cColorOut,
|
|
|
+ isnull(d.cBatch,'') as cBatchOut,
|
|
|
+ isnull(sum(d.iQuantity-d.iSQuantity+isnull(y.iQuantity,0)),0) as iQuantityOut,
|
|
|
+ z.cInvCCode as cInvCCodeOut
|
|
|
FROM
|
|
|
- OM_MODetails b
|
|
|
+ om_momain a
|
|
|
+ inner join OM_MODetails b on a.moid = b.moid
|
|
|
INNER JOIN Inventory c ON b.cinvcode = c.cinvcode
|
|
|
inner join rdrecords11 d on d.iOMoDID=b.MODetailsID
|
|
|
INNER JOIN Inventory z ON d.cinvcode = z.cinvcode
|
|
|
+ left outer join VIEW_OM_OUT_SETTLEVOUCE y on d.autoid=y.iRdsID
|
|
|
WHERE
|
|
|
b.MODetailsID in
|
|
|
<foreach item="item" collection="detailIdList" index="index" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
- group by b.MODetailsID,d.cInvCode,z.cInvName,d.cFree1,d.cBatch,z.cInvCCode
|
|
|
+ AND (y.cmocode is null or y.cmocode=a.cCode)
|
|
|
+ group by b.MODetailsID,d.cInvCode,z.cInvName,d.cFree1,d.cBatch,z.cInvCCode-->
|
|
|
</select>
|
|
|
<!-- 根据物料id获取入库信息:采购入库、委外入库、转换入库、其他入库 -->
|
|
|
<select id="getInListByInvId" resultType="org.jeecg.modules.report.entity.FabricCommonIn">
|
|
@@ -1151,4 +1220,40 @@
|
|
|
select * from VIEW_OM_OUT_19 where cOmCode like CONCAT(#{code},'%')
|
|
|
|
|
|
</select>
|
|
|
+ <!-- 根据委外订单子表id,获取入库详情-->
|
|
|
+ <select id="getOmInDetailListByDetailId" resultType="org.jeecg.modules.report.entity.FabricMoOrderRK">
|
|
|
+ select isnull(a.cCode,'') as cPlanCode,z.cCode,b.MODetailsID,
|
|
|
+ d.cVCName,c.cVenName,c.cVenAbbName,
|
|
|
+ x.cInvCode as cInvCode,y.cInvName as cInvName,isnull(x.cFree1,'') as cColor,isnull(x.cBatch,'') as cBatch,
|
|
|
+ isnull(x.iQuantity,0) as iQuantityIn,
|
|
|
+ isnull(isnull((select sum(n.iSum) from PurBillVouchs n where n.RdsId =x.autoid),x.iProcessFee),0) as iProcessFee,
|
|
|
+ isnull(x.iSumBillQuantity,0) as iSumBillQuantity,isnull(x.iSQuantity,0) as iSQuantity,
|
|
|
+ (select sum(isnull(iquantity,0)) as iQuantityOut from rdrecords11 d where d.iOMoDID=b.MODetailsID) as iQuantityOut,
|
|
|
+ y.cInvCCode
|
|
|
+ FROM
|
|
|
+ om_momain a
|
|
|
+ INNER JOIN OM_MODetails b ON a.moid = b.moid
|
|
|
+ inner join RdRecords01 x on x.iOMoDID=b.MODetailsID
|
|
|
+ inner join rdrecord01 z on x.id=z.id
|
|
|
+ INNER JOIN Inventory y ON x.cinvcode = y.cinvcode
|
|
|
+ inner join Vendor c on c.cVenCode=z.cVenCode
|
|
|
+ inner join VendorClass d on d.cVCCode =c.cVCCode
|
|
|
+ WHERE
|
|
|
+ y.cInvCCode NOT LIKE '19%' and b.MODetailsID in
|
|
|
+ <foreach item="item" collection="detailIdList" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <!-- 获取销售出库数量 -->
|
|
|
+ <select id="getSaleOutList" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
|
|
|
+ select a.ccode as cOmCode,c.cInvCode as cInvCodeOut,d.cInvName as cInvNameOut,
|
|
|
+ isnull(c.cFree1,'') as cColorOut,isnull(c.cBatch,'') as cBatchOut,c.iQuantity as iQuantityOut
|
|
|
+ from om_momain a
|
|
|
+ inner join OM_MODetails b on a.moid=b.moid
|
|
|
+ inner join rdrecords32 c on c.iorderdid =b.isosid
|
|
|
+ INNER JOIN Inventory d ON c.cinvcode = d.cinvcode
|
|
|
+ where a.ccode like CONCAT(#{code},'%')
|
|
|
+
|
|
|
+ </select>
|
|
|
</mapper>
|