|
@@ -5,14 +5,20 @@
|
|
|
|
|
|
<select id="getFabricLossData" resultType="org.jeecg.modules.report.entity.FabricLoss">
|
|
|
select distinct a.csocode as 'csoCode',b.cdefine22 as 'cDefine22',c.cPersonName as 'cPersonName',d.iQuantity as 'number',e.iQuantity as 'outboundNumber',
|
|
|
- f.dj as 'price',CONVERT(varchar,GETDATE(),120) as 'dateTime',a.csocode as 'csoCode',f.dj as 'actualPrice'
|
|
|
+ f.price as 'price',CONVERT(varchar,GETDATE(),120) as 'dateTime',a.csocode as 'csoCode',f.price as 'actualPrice',ta.cPOID as 'orderCode'
|
|
|
from SO_SOMain a left join SO_SODetails b on a.csocode=b.csocode
|
|
|
- left join Person c on a.cPersonCode=c.cPersonCode
|
|
|
- left join (select sum(a.iQuantity)as 'iQuantity' ,b.csocode from OM_MODetails a left join SO_SODetails b on a.isosid =b.isosid left join OM_MOMain c on a.moid=c.moid GROUP BY b.csocode) d on a.csocode=d.csocode
|
|
|
- left join (select sum(iQuantity) as 'iQuantity',csocode from rdrecords32 GROUP BY csocode) e on a.csocode=e.csocode
|
|
|
- left join (select (b.iProcessFee+b.iMaterialFee)/b.iQuantity as 'dj',b.csocode from (
|
|
|
- select sum(b.iMaterialFee) as 'iMaterialFee',sum(b.iProcessFee) as 'iProcessFee',sum(b.iQuantity) as 'iQuantity',bc.csocode from rdrecord01 a left join rdrecords01 b on a.id=b.id
|
|
|
- GROUP BY bc.csocode) b ) f on a.csocode=f.csocode
|
|
|
+ left join Person c on a.cPersonCode=c.cPersonCode
|
|
|
+ left join (select sum(isnull(a.iQuantity,0))as 'iQuantity' ,b.csocode from OM_MODetails a left join SO_SODetails b on a.isosid =b.isosid left join OM_MOMain c on a.moid=c.moid GROUP BY b.csocode) d on a.csocode=d.csocode
|
|
|
+ left join (select sum(isnull(iQuantity,0)) as 'iQuantity',csocode from rdrecords32 GROUP BY csocode) e on a.csocode=e.csocode
|
|
|
+ left join (select isnull(sum(a.count)/sum(b.iquantity),0) as 'price',b.csoordercode from (
|
|
|
+ select sum((isnull(c.iQuantity,0)*isnull(b.iunitcost,0))+(isnull(c.iQuantity,0)*isnull(b.iprocesscost,0))) as 'count' ,a.cordercode as 'cordercode' from rdrecord01 a left join rdrecords01 b on a.id=b.id
|
|
|
+ left join (select sum(b.iquantity)as 'iquantity',b.cbatch,b.iorderdid,cmpocode from rdrecord11 a left join rdrecords11 b on a.id=b.id
|
|
|
+ where b.cbatch is not null GROUP BY b.iorderdid,cbatch,cmpocode) c on b.iorderdid=c.iorderdid and a.cordercode=c.cmpocode AND c.cbatch=b.cbatch
|
|
|
+ GROUP BY a.cordercode) a
|
|
|
+ left join (select sum(isnull(b.iquantity,0)) as 'iquantity',a.ccode,b.csoordercode from OM_MOMain a left join OM_MODetails b on a.moid=b.moid
|
|
|
+ GROUP BY a.ccode,b.csoordercode) b on a.cordercode=b.ccode
|
|
|
+ where a.count !='0' GROUP BY b.csoordercode) f on a.csocode=f.csoordercode
|
|
|
+ left join (select a.cpoid as 'cpoid',b.csoordercode as 'csoordercode' from PO_Pomain a left join PO_Podetails b on a.POID=b.POID) ta on a.csocode=ta.csoordercode
|
|
|
where 1=1
|
|
|
<if test="code!=null and ''!=code">
|
|
|
a.csocode=#{code}
|
|
@@ -20,7 +26,9 @@
|
|
|
</select>
|
|
|
<select id="getPlanner" resultType="java.lang.String">
|
|
|
select distinct c.cMaker from OM_MODetails a
|
|
|
- left join OM_MOMain c on a.moid=c.moid where 1=1
|
|
|
+ left join OM_MOMain c on a.moid=c.moid
|
|
|
+ left join Vendor b on c.cvencode=b.cvencode
|
|
|
+ where b.cvccode='0105'
|
|
|
<if test="code!=null and ''!=code">
|
|
|
a.csocode=#{code}
|
|
|
</if>
|
|
@@ -33,20 +41,32 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="getNumber" resultType="java.lang.String">
|
|
|
- select sum(a.iQuantity)as 'iQuantity' from OM_MODetails a left join SO_SODetails b on a.isosid =b.isosid
|
|
|
+ select sum(isnull(a.iQuantity,0))as 'iQuantity' from OM_MODetails a left join SO_SODetails b on a.isosid =b.isosid
|
|
|
left join OM_MOMain c on a.moid=c.moid where 1=1
|
|
|
<if test="code!=null and ''!=code">
|
|
|
b.csocode=#{code}
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="getPrice" resultType="java.lang.String">
|
|
|
- select (b.iProcessFee+b.iMaterialFee)/b.iQuantity as 'dj' from (
|
|
|
- select sum(b.iMaterialFee) as 'iMaterialFee',sum(b.iProcessFee) as 'iProcessFee',sum(b.iQuantity) as 'iQuantity',bc.csocode from rdrecord01 a left join rdrecords01 b on a.id=b.id
|
|
|
- left join OM_MOMain c on c.moid=a.ipurorderid
|
|
|
- left join OM_MODetails bc on c.moid=bc.moid
|
|
|
- GROUP BY bc.csocode) b where 1=1
|
|
|
+ select isnull(sum(a.count)/sum(b.iquantity),0) as 'price' from (
|
|
|
+ select sum((isnull(c.iQuantity,0)*isnull(b.iunitcost,0))+(isnull(c.iQuantity,0)*isnull(b.iprocesscost,0))) as 'count' ,a.cordercode as 'cordercode' from rdrecord01 a left join rdrecords01 b on a.id=b.id
|
|
|
+ left join (select sum(b.iquantity)as 'iquantity',b.cbatch,b.iorderdid,cmpocode from rdrecord11 a left join rdrecords11 b on a.id=b.id
|
|
|
+ where b.cbatch is not null GROUP BY b.iorderdid,cbatch,cmpocode) c on b.iorderdid=c.iorderdid and a.cordercode=c.cmpocode AND c.cbatch=b.cbatch
|
|
|
+ GROUP BY a.cordercode) a
|
|
|
+ left join (select sum(isnull(b.iquantity,0)) as 'iquantity',a.ccode,b.csoordercode from OM_MOMain a left join OM_MODetails b on a.moid=b.moid
|
|
|
+ GROUP BY a.ccode,b.csoordercode) b on a.cordercode=b.ccode
|
|
|
+ where a.count !='0'
|
|
|
<if test="code!=null and ''!=code">
|
|
|
- b.csocode=#{code}
|
|
|
+ and b.csoordercode=#{code}
|
|
|
</if>
|
|
|
+ GROUP BY b.csoordercode
|
|
|
</select>
|
|
|
+ <select id="getOrderCode" resultType="java.lang.String">
|
|
|
+ select distinct a.cpoid as 'cpoid' from PO_Pomain a left join PO_Podetails b on a.POID=b.POID
|
|
|
+ where a.cVenCode='T020001'
|
|
|
+ <if test="code!=null and ''!=code">
|
|
|
+ and b.csoordercode=#{code}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|