|
@@ -22,103 +22,103 @@
|
|
|
max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
|
|
|
max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department,
|
|
|
max(cc.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
|
|
|
- max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal,
|
|
|
- sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity
|
|
|
- FROM UFDATA_101_2021.dbo.SO_SODetails s
|
|
|
+ max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal,
|
|
|
+ sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity
|
|
|
+ FROM UFDATA_101_2021.dbo.SO_SODetails s
|
|
|
inner JOIN UFDATA_101_2021.dbo.SO_SOMain ss on ss.ID= s.ID
|
|
|
|
|
|
inner JOIN (
|
|
|
- SELECT
|
|
|
- om.cCode AS omCode,
|
|
|
- om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
|
|
|
- om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
|
|
|
- FROM
|
|
|
- UFDATA_101_2021.dbo.OM_MOMain om
|
|
|
- inner JOIN UFDATA_101_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
|
|
|
+ SELECT
|
|
|
+ om.cCode AS omCode,
|
|
|
+ om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
|
|
|
+ om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
|
|
|
+ FROM
|
|
|
+ UFDATA_101_2021.dbo.OM_MOMain om
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
|
|
|
inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_101_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
|
|
|
WHERE
|
|
|
om.iVerifyStateNew = 2 and om.cCode like CONCAT(#{code},'%')
|
|
|
and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
|
|
|
- ) o ON s.isosid = o.isosid AND s.cInvCode = o.cInvCode
|
|
|
- inner JOIN UFDATA_101_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
|
|
|
- inner JOIN UFDATA_101_2021.dbo.Inventory c on c.cInvCode=s.cInvCode
|
|
|
- inner JOIN UFDATA_101_2021.dbo.Person pe ON ss.cPersonCode = pe.cPersonCode
|
|
|
- inner JOIN UFDATA_101_2021.dbo.Department de ON ss.cDepCode = de.cDepCode
|
|
|
- inner JOIN UFDATA_101_2021.dbo.Customer cc ON ss.cCusCode = cc.cCusCode
|
|
|
+ ) o ON s.isosid = o.isosid AND s.cInvCode = o.cInvCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Inventory c on c.cInvCode=s.cInvCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Person pe ON ss.cPersonCode = pe.cPersonCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Department de ON ss.cDepCode = de.cDepCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Customer cc ON ss.cCusCode = cc.cCusCode
|
|
|
WHERE c.cInvCcode like '19%' GROUP BY v.cVenAbbName
|
|
|
-
|
|
|
- union all
|
|
|
-
|
|
|
+
|
|
|
+ union all
|
|
|
+
|
|
|
SELECT max(ss.iExchRate) as exchangeRate,min(s.iTaxUnitPrice) as soPrice,'103' as pkOrg,
|
|
|
- max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
|
|
|
+ max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
|
|
|
max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department,
|
|
|
max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
|
|
|
- max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal,
|
|
|
- sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity
|
|
|
- FROM UFDATA_103_2021.dbo.SO_SODetails a
|
|
|
- inner JOIN UFDATA_103_2021.dbo.SO_SOMain b on b.ID= a.ID
|
|
|
- inner JOIN (
|
|
|
- SELECT
|
|
|
- om.cCode AS omCode, od.csoordercode,
|
|
|
- om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
|
|
|
- om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
|
|
|
- FROM
|
|
|
- UFDATA_103_2021.dbo.OM_MOMain om
|
|
|
- inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
|
|
|
+ max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal,
|
|
|
+ sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity
|
|
|
+ FROM UFDATA_103_2021.dbo.SO_SODetails a
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.SO_SOMain b on b.ID= a.ID
|
|
|
+ inner JOIN (
|
|
|
+ SELECT
|
|
|
+ om.cCode AS omCode, od.csoordercode,
|
|
|
+ om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
|
|
|
+ om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
|
|
|
+ FROM
|
|
|
+ UFDATA_103_2021.dbo.OM_MOMain om
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
|
|
|
inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
|
|
|
WHERE
|
|
|
om.iVerifyStateNew = 2 and om.cCode like CONCAT(#{code},'%')
|
|
|
and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
|
|
|
- ) o ON a.isosid = o.isosid AND a.cInvCode = o.cInvCode
|
|
|
- inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
|
|
|
- inner JOIN UFDATA_103_2021.dbo.Inventory c on c.cInvCode=a.cInvCode
|
|
|
- inner JOIN UFDATA_103_2021.dbo.Person pe ON b.cPersonCode = pe.cPersonCode
|
|
|
+ ) o ON a.isosid = o.isosid AND a.cInvCode = o.cInvCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Inventory c on c.cInvCode=a.cInvCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Person pe ON b.cPersonCode = pe.cPersonCode
|
|
|
inner JOIN UFDATA_103_2021.dbo.Department de ON b.cDepCode = de.cDepCode
|
|
|
- inner JOIN UFDATA_103_2021.dbo.Customer cc ON b.cCusCode = cc.cCusCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Customer cc ON b.cCusCode = cc.cCusCode
|
|
|
inner join UFDATA_102_2021.dbo.PO_Pomain f on f.cPOID=o.csoordercode
|
|
|
inner join UFDATA_102_2021.dbo.po_podetails g on g.POID=f.POID and g.ivouchrowno=a.iRowNo
|
|
|
inner join UFDATA_102_2021.dbo.SO_SODetails s on s.iSOsID=g.iorderdid
|
|
|
inner join UFDATA_102_2021.dbo.so_somain ss on ss.id=s.id
|
|
|
|
|
|
- inner join UFDATA_102_2021.dbo.Person j on j.cPersonCode=ss.cPersonCode
|
|
|
- inner JOIN UFDATA_102_2021.dbo.Customer cu ON ss.cCusCode = cu.cCusCode
|
|
|
+ inner join UFDATA_102_2021.dbo.Person j on j.cPersonCode=ss.cPersonCode
|
|
|
+ inner JOIN UFDATA_102_2021.dbo.Customer cu ON ss.cCusCode = cu.cCusCode
|
|
|
WHERE cc.cCusCode in ('T020001','0001') and ss.cCusCode not in ('T020001','0001') and c.cInvCcode like '19%' GROUP BY v.cVenAbbName
|
|
|
-
|
|
|
-
|
|
|
- union all
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ union all
|
|
|
+
|
|
|
SELECT max(ss.iExchRate) as exchangeRate,min(s.iTaxUnitPrice) as soPrice,'103' as pkOrg,
|
|
|
- max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
|
|
|
+ max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
|
|
|
max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department,
|
|
|
max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
|
|
|
- max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal,
|
|
|
- sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity
|
|
|
- FROM UFDATA_103_2021.dbo.SO_SODetails a
|
|
|
- inner JOIN UFDATA_103_2021.dbo.SO_SOMain b on b.ID= a.ID
|
|
|
- inner JOIN (
|
|
|
- SELECT
|
|
|
- om.cCode AS omCode, od.csoordercode,
|
|
|
- om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
|
|
|
- om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
|
|
|
- FROM
|
|
|
- UFDATA_103_2021.dbo.OM_MOMain om
|
|
|
- inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
|
|
|
+ max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal,
|
|
|
+ sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity
|
|
|
+ FROM UFDATA_103_2021.dbo.SO_SODetails a
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.SO_SOMain b on b.ID= a.ID
|
|
|
+ inner JOIN (
|
|
|
+ SELECT
|
|
|
+ om.cCode AS omCode, od.csoordercode,
|
|
|
+ om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
|
|
|
+ om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
|
|
|
+ FROM
|
|
|
+ UFDATA_103_2021.dbo.OM_MOMain om
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
|
|
|
inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
|
|
|
WHERE
|
|
|
om.iVerifyStateNew = 2 and om.cCode like CONCAT(#{code},'%')
|
|
|
and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
|
|
|
- ) o ON a.isosid = o.isosid AND a.cInvCode = o.cInvCode
|
|
|
- inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
|
|
|
- inner JOIN UFDATA_103_2021.dbo.Inventory c on c.cInvCode=a.cInvCode
|
|
|
- inner JOIN UFDATA_103_2021.dbo.Person pe ON b.cPersonCode = pe.cPersonCode
|
|
|
+ ) o ON a.isosid = o.isosid AND a.cInvCode = o.cInvCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Inventory c on c.cInvCode=a.cInvCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Person pe ON b.cPersonCode = pe.cPersonCode
|
|
|
inner JOIN UFDATA_103_2021.dbo.Department de ON b.cDepCode = de.cDepCode
|
|
|
- inner JOIN UFDATA_103_2021.dbo.Customer cc ON b.cCusCode = cc.cCusCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Customer cc ON b.cCusCode = cc.cCusCode
|
|
|
inner join UFDATA_101_2021.dbo.PO_Pomain f on f.cPOID=o.csoordercode
|
|
|
inner join UFDATA_101_2021.dbo.po_podetails g on g.POID=f.POID and g.ivouchrowno=a.iRowNo
|
|
|
inner join UFDATA_101_2021.dbo.SO_SODetails s on s.iSOsID=g.iorderdid
|
|
|
inner join UFDATA_101_2021.dbo.so_somain ss on ss.id=s.id
|
|
|
- inner join UFDATA_101_2021.dbo.Person j on j.cPersonCode=ss.cPersonCode
|
|
|
- inner JOIN UFDATA_101_2021.dbo.Customer cu ON ss.cCusCode = cu.cCusCode
|
|
|
+ inner join UFDATA_101_2021.dbo.Person j on j.cPersonCode=ss.cPersonCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Customer cu ON ss.cCusCode = cu.cCusCode
|
|
|
WHERE cc.cCusCode in ('T020001') and ss.cCusCode not in ('T020001','0001') and c.cInvCcode like '19%' GROUP BY v.cVenAbbName
|
|
|
UNION ALL
|
|
|
|
|
@@ -211,6 +211,136 @@
|
|
|
*/
|
|
|
</select>
|
|
|
|
|
|
+ <select id="queryByCostHead2" resultType="java.lang.String">
|
|
|
+ -- SS23-RPI-59960,SS23-PRI-59960-2
|
|
|
+
|
|
|
+ SELECT DISTINCT ss.cSOCode
|
|
|
+ FROM UFDATA_101_2021.dbo.SO_SODetails s
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.SO_SOMain ss on ss.ID= s.ID
|
|
|
+
|
|
|
+ inner JOIN (
|
|
|
+ SELECT
|
|
|
+ om.cCode AS omCode,
|
|
|
+ om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
|
|
|
+ om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
|
|
|
+ FROM
|
|
|
+ UFDATA_101_2021.dbo.OM_MOMain om
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
|
|
|
+ inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_101_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
|
|
|
+ WHERE
|
|
|
+ om.iVerifyStateNew = 2 and om.cCode like CONCAT(#{code},'%')
|
|
|
+ and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
|
|
|
+ ) o ON s.isosid = o.isosid AND s.cInvCode = o.cInvCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Inventory c on c.cInvCode=s.cInvCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Person pe ON ss.cPersonCode = pe.cPersonCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Department de ON ss.cDepCode = de.cDepCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Customer cc ON ss.cCusCode = cc.cCusCode
|
|
|
+ WHERE c.cInvCcode like '19%'
|
|
|
+
|
|
|
+ union all
|
|
|
+
|
|
|
+ SELECT DISTINCT ss.cSOCode
|
|
|
+ FROM UFDATA_103_2021.dbo.SO_SODetails a
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.SO_SOMain b on b.ID= a.ID
|
|
|
+ inner JOIN (
|
|
|
+ SELECT
|
|
|
+ om.cCode AS omCode, od.csoordercode,
|
|
|
+ om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
|
|
|
+ om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
|
|
|
+ FROM
|
|
|
+ UFDATA_103_2021.dbo.OM_MOMain om
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
|
|
|
+ inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
|
|
|
+ WHERE
|
|
|
+ om.iVerifyStateNew = 2 and om.cCode like CONCAT(#{code},'%')
|
|
|
+ and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
|
|
|
+ ) o ON a.isosid = o.isosid AND a.cInvCode = o.cInvCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Inventory c on c.cInvCode=a.cInvCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Person pe ON b.cPersonCode = pe.cPersonCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Department de ON b.cDepCode = de.cDepCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Customer cc ON b.cCusCode = cc.cCusCode
|
|
|
+ inner join UFDATA_102_2021.dbo.PO_Pomain f on f.cPOID=o.csoordercode
|
|
|
+ inner join UFDATA_102_2021.dbo.po_podetails g on g.POID=f.POID and g.ivouchrowno=a.iRowNo
|
|
|
+ inner join UFDATA_102_2021.dbo.SO_SODetails s on s.iSOsID=g.iorderdid
|
|
|
+ inner join UFDATA_102_2021.dbo.so_somain ss on ss.id=s.id
|
|
|
+
|
|
|
+ inner join UFDATA_102_2021.dbo.Person j on j.cPersonCode=ss.cPersonCode
|
|
|
+ inner JOIN UFDATA_102_2021.dbo.Customer cu ON ss.cCusCode = cu.cCusCode
|
|
|
+ WHERE cc.cCusCode in ('T020001','0001') and ss.cCusCode not in ('T020001','0001') and c.cInvCcode like '19%'
|
|
|
+
|
|
|
+
|
|
|
+ union all
|
|
|
+
|
|
|
+ SELECT DISTINCT ss.cSOCode
|
|
|
+ FROM UFDATA_103_2021.dbo.SO_SODetails a
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.SO_SOMain b on b.ID= a.ID
|
|
|
+ inner JOIN (
|
|
|
+ SELECT
|
|
|
+ om.cCode AS omCode, od.csoordercode,
|
|
|
+ om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
|
|
|
+ om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
|
|
|
+ FROM
|
|
|
+ UFDATA_103_2021.dbo.OM_MOMain om
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
|
|
|
+ inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
|
|
|
+ WHERE
|
|
|
+ om.iVerifyStateNew = 2 and om.cCode like CONCAT(#{code},'%')
|
|
|
+ and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
|
|
|
+ ) o ON a.isosid = o.isosid AND a.cInvCode = o.cInvCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Inventory c on c.cInvCode=a.cInvCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Person pe ON b.cPersonCode = pe.cPersonCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Department de ON b.cDepCode = de.cDepCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Customer cc ON b.cCusCode = cc.cCusCode
|
|
|
+ inner join UFDATA_101_2021.dbo.PO_Pomain f on f.cPOID=o.csoordercode
|
|
|
+ inner join UFDATA_101_2021.dbo.po_podetails g on g.POID=f.POID and g.ivouchrowno=a.iRowNo
|
|
|
+ inner join UFDATA_101_2021.dbo.SO_SODetails s on s.iSOsID=g.iorderdid
|
|
|
+ inner join UFDATA_101_2021.dbo.so_somain ss on ss.id=s.id
|
|
|
+ inner join UFDATA_101_2021.dbo.Person j on j.cPersonCode=ss.cPersonCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Customer cu ON ss.cCusCode = cu.cCusCode
|
|
|
+ WHERE cc.cCusCode in ('T020001') and ss.cCusCode not in ('T020001','0001') and c.cInvCcode like '19%'
|
|
|
+ UNION ALL
|
|
|
+
|
|
|
+ SELECT DISTINCT ss1.cSOCode
|
|
|
+ FROM UFDATA_103_2021.dbo.SO_SODetails a
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.SO_SOMain b on b.ID= a.ID
|
|
|
+ inner JOIN (
|
|
|
+ SELECT
|
|
|
+ om.cCode AS omCode, od.csoordercode,
|
|
|
+ om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
|
|
|
+ om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
|
|
|
+ FROM
|
|
|
+ UFDATA_103_2021.dbo.OM_MOMain om
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
|
|
|
+ inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
|
|
|
+ WHERE
|
|
|
+ om.iVerifyStateNew = 2 and om.cCode like CONCAT(#{code},'%')
|
|
|
+ and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
|
|
|
+ ) o ON a.isosid = o.isosid AND a.cInvCode = o.cInvCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Inventory c on c.cInvCode=a.cInvCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Person pe ON b.cPersonCode = pe.cPersonCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Department de ON b.cDepCode = de.cDepCode
|
|
|
+ inner JOIN UFDATA_103_2021.dbo.Customer cc ON b.cCusCode = cc.cCusCode
|
|
|
+ inner join UFDATA_102_2021.dbo.PO_Pomain f on f.cPOID=o.csoordercode
|
|
|
+ inner join UFDATA_102_2021.dbo.po_podetails g on g.POID=f.POID and g.ivouchrowno=a.iRowNo
|
|
|
+ inner join UFDATA_102_2021.dbo.SO_SODetails s on s.iSOsID=g.iorderdid
|
|
|
+ inner join UFDATA_102_2021.dbo.so_somain ss on ss.id=s.id
|
|
|
+
|
|
|
+ inner join UFDATA_101_2021.dbo.PO_Pomain f1 on f1.cPOID=ss.csocode
|
|
|
+ inner join UFDATA_101_2021.dbo.po_podetails g1 on g1.POID=f1.POID and g1.ivouchrowno=s.iRowNo
|
|
|
+ inner join UFDATA_101_2021.dbo.SO_SODetails s1 on s1.iSOsID=g1.iorderdid
|
|
|
+ inner join UFDATA_101_2021.dbo.so_somain ss1 on ss1.id=s1.id
|
|
|
+
|
|
|
+ inner join UFDATA_101_2021.dbo.Person j on j.cPersonCode=ss1.cPersonCode
|
|
|
+ inner JOIN UFDATA_101_2021.dbo.Customer cu ON ss1.cCusCode = cu.cCusCode
|
|
|
+ WHERE cc.cCusCode in ('0001') and ss.cCusCode in ('T020001') and c.cInvCcode like '19%'
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ </select>
|
|
|
|
|
|
<select id="queryPurBillVouchByFabric" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
|
|
|
|