|
@@ -1,58 +1,34 @@
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="org.jeecg.modules.scas.mapper.SupplierCapacityMapper">
|
|
|
- <select id="select" resultType="org.jeecg.modules.scas.entity.SupplierCapacity" parameterType="org.jeecg.modules.scas.dto.SupplierCapacityDto">
|
|
|
- select * from
|
|
|
- (select ROW_NUMBER() OVER(ORDER BY PO_Pomain.poid) index1,
|
|
|
- PO_Pomain.cPOID csrccode,
|
|
|
- PlanLotNumber cPlanLotNumber,
|
|
|
- cDepname cDepCode,
|
|
|
- cPersonName cPersonCode,
|
|
|
- cVenName cVenCode,
|
|
|
- cVCName cVenCodeType,
|
|
|
- '采购订单' iOrderType,
|
|
|
- iQuantity,
|
|
|
- iReceivedQTY,
|
|
|
- cComUnitName unit,
|
|
|
- month(dArriveDate) arriveMonth,
|
|
|
- dArriveDate,
|
|
|
- isnull(Inventory.cInvDefine1,'0') coefficient
|
|
|
- from PO_Pomain
|
|
|
- left join PO_Podetails on PO_Podetails.POID=PO_Pomain.POID
|
|
|
- left join Department on Department.cdepcode=PO_Pomain.cDepCode
|
|
|
- left join Person on Person.cPersonCode=PO_Pomain.cPersonCode
|
|
|
- left join Vendor on Vendor.cVenCode=PO_Pomain.cVenCode
|
|
|
- left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
- left join ComputationUnit on PO_Podetails.cUnitID=ComputationUnit.cComunitCode
|
|
|
- left join Inventory on PO_Podetails.cInvCode=Inventory.cInvCode
|
|
|
- <where>
|
|
|
- <if test="csrccode!=null">
|
|
|
- AND PO_Pomain.cPOID=#{csrccode} --订单号
|
|
|
- </if>
|
|
|
- <if test="iOrderType!=null">
|
|
|
- AND PO_Podetails.iOrderType=#{iOrderType} --订单类型
|
|
|
- </if>
|
|
|
- <if test="cVenCode!=null">
|
|
|
- AND Vendor.cVenName=#{cVenCode} --供应商名称
|
|
|
- </if>
|
|
|
- <if test="cPlanLotNumber!=null">
|
|
|
- AND PO_Podetails.planlotnumber=#{cPlanLotNumber} --计划单号
|
|
|
- </if>
|
|
|
- <if test="startDate!=null">
|
|
|
- AND PO_Podetails.darriveDate>=#{startDate} --起始日期
|
|
|
- </if>
|
|
|
- <if test="endDate!=null">
|
|
|
- AND PO_Podetails.darriveDate<=#{endDate} --结束日期
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- ) p --计划时间
|
|
|
- where p.index1>=${pageNo*pageSize-pageSize} and p.index1<=${pageSize*pageNo}
|
|
|
-
|
|
|
- </select>
|
|
|
|
|
|
- <select id="select2" resultType="org.jeecg.modules.scas.entity.SupplierCapacity" parameterType="org.jeecg.modules.scas.dto.SupplierCapacityDto">
|
|
|
- select * from
|
|
|
- (select ROW_NUMBER() OVER(ORDER BY OM_MOMain.moid) index1,
|
|
|
+ <select id="querySelect" resultType="org.jeecg.modules.scas.entity.SupplierCapacity" parameterType="org.jeecg.modules.scas.dto.SupplierCapacityDto">
|
|
|
+ select * from
|
|
|
+ (select ROW_NUMBER() OVER(ORDER BY cVenCode) index1,* from
|
|
|
+ (select --ROW_NUMBER() OVER(ORDER BY PO_Pomain.poid) index1,
|
|
|
+ PO_Pomain.cPOID csrccode,
|
|
|
+ PlanLotNumber cPlanLotNumber,
|
|
|
+ cDepname cDepCode,
|
|
|
+ cPersonName cPersonCode,
|
|
|
+ cVenName cVenCode,
|
|
|
+ cVCName cVenCodeType,
|
|
|
+ '采购订单' iOrderType,
|
|
|
+ iQuantity,
|
|
|
+ iReceivedQTY,
|
|
|
+ cComUnitName unit,
|
|
|
+ month(dArriveDate) arriveMonth,
|
|
|
+ dArriveDate,
|
|
|
+ isnull(Inventory.cInvDefine1,0) coefficient
|
|
|
+ from PO_Pomain
|
|
|
+ left join PO_Podetails on PO_Podetails.POID=PO_Pomain.POID
|
|
|
+ left join Department on Department.cdepcode=PO_Pomain.cDepCode
|
|
|
+ left join Person on Person.cPersonCode=PO_Pomain.cPersonCode
|
|
|
+ left join Vendor on Vendor.cVenCode=PO_Pomain.cVenCode
|
|
|
+ left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
+ left join ComputationUnit on PO_Podetails.cUnitID=ComputationUnit.cComunitCode
|
|
|
+ left join Inventory on PO_Podetails.cInvCode=Inventory.cInvCode
|
|
|
+ union
|
|
|
+ select --ROW_NUMBER() OVER(ORDER BY OM_MOMain.moid) index1,
|
|
|
OM_MOMain.cCode csrccode,
|
|
|
cPlanLotNumber,
|
|
|
cDepname cDepCode,
|
|
@@ -65,7 +41,7 @@
|
|
|
cComUnitName unit,
|
|
|
month(dArriveDate) arriveMonth,
|
|
|
dArriveDate,
|
|
|
- isnull(Inventory.cInvDefine1,'0') coefficient
|
|
|
+ isnull(Inventory.cInvDefine1,0) coefficient
|
|
|
from OM_MOMain
|
|
|
left join OM_MODetails on OM_MODetails.moid=OM_MOMain.moid
|
|
|
left join Department on Department.cdepcode=OM_MOMain.cDepCode
|
|
@@ -74,89 +50,91 @@
|
|
|
left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
left join ComputationUnit on OM_MODetails.cUnitID=ComputationUnit.cComunitCode
|
|
|
left join Inventory on OM_MODetails.cInvCode=Inventory.cInvCode
|
|
|
+ ) p
|
|
|
<where>
|
|
|
<if test="csrccode!=null">
|
|
|
- AND OM_MOMain.cCode=#{csrccode} --订单号
|
|
|
+ and csrccode=#{csrccode}----订单号
|
|
|
</if>
|
|
|
<if test="iOrderType!=null">
|
|
|
- AND OM_MOMain.iOrderType=#{iOrderType} --订单类型
|
|
|
+ AND iOrderType=#{iOrderType}--订单类型
|
|
|
</if>
|
|
|
<if test="cVenCode!=null">
|
|
|
- AND Vendor.cVenName=#{cVenCode} --供应商名称
|
|
|
+ and cVenCode=#{cVenCode}--供应商
|
|
|
</if>
|
|
|
<if test="cPlanLotNumber!=null">
|
|
|
- AND OM_MODetails.cplanlotnumber=#{cPlanLotNumber} --计划单号
|
|
|
+ and cPlanLotNumber=#{cPlanLotNumber}--计划单号
|
|
|
</if>
|
|
|
<if test="startDate!=null">
|
|
|
- AND OM_MODetails.darriveDate>=#{startDate} --起始日期
|
|
|
+ and arriveMonth>=$#{startDate} --起始日期
|
|
|
</if>
|
|
|
<if test="endDate!=null">
|
|
|
- AND OM_MODetails.darriveDate<=#{endDate} --结束日期
|
|
|
+ and arriveMonth<=$#{endDate} --结束日期
|
|
|
</if>
|
|
|
</where>
|
|
|
- ) p --计划时间
|
|
|
- where p.index1>=${pageNo*pageSize-pageSize} and p.index1<=${pageSize*pageNo}
|
|
|
+ )s
|
|
|
+ --where s.index1>=$100 and s.index1<=$0
|
|
|
+ where s.index1>=${pageNo*pageSize-pageSize} and s.index1<=${pageSize*pageNo}
|
|
|
</select>
|
|
|
|
|
|
- <resultMap type="java.util.HashMap" id="getSupplierCapacity">
|
|
|
- <!-- 主键 -->
|
|
|
- <id column="index1" property="index1"/>
|
|
|
- <!-- 非主键 -->
|
|
|
- <result column="arriveMonth" property="arriveMonth"/>
|
|
|
- <result column="iQuantity" property="iQuantity"/>
|
|
|
- <result column="iReceivedQTY" property="iReceivedQTY"/>
|
|
|
- <result column="coefficient" property="coefficient"/>
|
|
|
- <result column="cVenCode" property="cVenCode"/>
|
|
|
- <result column="cDepCode" property="cDepCode"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
-
|
|
|
- <select id="excel1" resultMap="getSupplierCapacity">
|
|
|
- --部门 供应商 月份 数量 累计入库数量 能耗(能耗相加的汇总)
|
|
|
- select ROW_NUMBER() OVER(ORDER BY cVenName) index1,
|
|
|
- cDepname cDepCode,
|
|
|
- cVenName cVenCode,
|
|
|
- month(dArriveDate) arriveMonth,
|
|
|
- sum(iQuantity) iQuantity,
|
|
|
- sum(iReceivedQTY) iReceivedQTY,
|
|
|
- sum(cast(isnull(cInvDefine1,'0') as decimal)) coefficient
|
|
|
- from PO_Pomain
|
|
|
- left join PO_Podetails on PO_Podetails.POID=PO_Pomain.POID
|
|
|
- left join Department on Department.cdepcode=PO_Pomain.cDepCode
|
|
|
- left join Person on Person.cPersonCode=PO_Pomain.cPersonCode
|
|
|
- left join Vendor on Vendor.cVenCode=PO_Pomain.cVenCode
|
|
|
- left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
- left join Inventory on PO_Podetails.cInvCode=Inventory.cInvCode
|
|
|
- group by cVenName,cDepname,month(dArriveDate)
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="excel2" resultMap="getSupplierCapacity">
|
|
|
- --供应商 月份 数量 累计入库数量 能耗
|
|
|
- select ROW_NUMBER() OVER(ORDER BY cVenName) index1,
|
|
|
- cVenName cVenCode,
|
|
|
- month(dArriveDate) arriveMonth,
|
|
|
- sum(iQuantity) iQuantity,
|
|
|
- sum(iReceivedQTY) iReceivedQTY,
|
|
|
- sum(cast(isnull(cInvDefine1,'0') as decimal)) coefficient
|
|
|
- from PO_Pomain
|
|
|
- left join PO_Podetails on PO_Podetails.POID=PO_Pomain.POID
|
|
|
- left join Department on Department.cdepcode=PO_Pomain.cDepCode
|
|
|
- left join Person on Person.cPersonCode=PO_Pomain.cPersonCode
|
|
|
- left join Vendor on Vendor.cVenCode=PO_Pomain.cVenCode
|
|
|
- left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
- left join Inventory on PO_Podetails.cInvCode=Inventory.cInvCode
|
|
|
- group by cVenName,month(dArriveDate)
|
|
|
+ <select id="excel001" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacityVo1">
|
|
|
+ --部门 供应商 月份 数量 累计入库数量 能耗(能耗相加的汇总)--汇合
|
|
|
+ select
|
|
|
+ p.cDepCode,
|
|
|
+ p.cVenCode,
|
|
|
+ p.arriveMonth,
|
|
|
+ sum(p.iQuantity) iQuantity,
|
|
|
+ sum(p.iReceivedQTY) iReceivedQTY,
|
|
|
+ sum(p.coefficient) coefficient
|
|
|
+ from (
|
|
|
+ select cDepname cDepCode,
|
|
|
+ cVenName cVenCode,
|
|
|
+ month(dArriveDate) arriveMonth,
|
|
|
+ iQuantity iQuantity,
|
|
|
+ iReceivedQTY iReceivedQTY,
|
|
|
+ cast(isnull(cInvDefine1,'0') as decimal) coefficient
|
|
|
+ from PO_Pomain
|
|
|
+ left join PO_Podetails on PO_Podetails.POID=PO_Pomain.POID
|
|
|
+ left join Department on Department.cdepcode=PO_Pomain.cDepCode
|
|
|
+ left join Person on Person.cPersonCode=PO_Pomain.cPersonCode
|
|
|
+ left join Vendor on Vendor.cVenCode=PO_Pomain.cVenCode
|
|
|
+ left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
+ left join Inventory on PO_Podetails.cInvCode=Inventory.cInvCode
|
|
|
+ --order by cDepCode,cVenCode,arriveMonth
|
|
|
+ UNION
|
|
|
+ select cDepname cDepCode,
|
|
|
+ cVenName cVenCode,
|
|
|
+ month(dArriveDate) arriveMonth,
|
|
|
+ iQuantity,
|
|
|
+ iReceivedQTY,
|
|
|
+ cast(isnull(cInvDefine1,'0') as decimal) coefficient
|
|
|
+ from OM_MOMain
|
|
|
+ left join OM_MODetails on OM_MODetails.moid=OM_MOMain.moid
|
|
|
+ left join Department on Department.cdepcode=OM_MOMain.cDepCode
|
|
|
+ left join Person on Person.cPersonCode=OM_MOMain.cPersonCode
|
|
|
+ left join Vendor on Vendor.cVenCode=OM_MOMain.cVenCode
|
|
|
+ left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
+ left join Inventory on OM_MODetails.cInvCode=Inventory.cInvCode
|
|
|
+ --order by cDepCode,cVenCode,arriveMonth
|
|
|
+ )p
|
|
|
+ group by p.cDepCode,p.cVenCode,p.arriveMonth
|
|
|
+ order by p.cDepCode,p.cVenCode,p.arriveMonth
|
|
|
</select>
|
|
|
|
|
|
+ <select id="excel002" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacityVo2">
|
|
|
|
|
|
- <select id="excel3" resultMap="getSupplierCapacity">
|
|
|
- --部门 月份 数量 累计入库数量 能耗
|
|
|
- select ROW_NUMBER() OVER(ORDER BY cDepname) index1,
|
|
|
- cDepname cDepCode,
|
|
|
+ --部门 月份 数量 累计入库数量 能耗(能耗相加的汇总)
|
|
|
+ select p.cDepCode,
|
|
|
+ p.arriveMonth,
|
|
|
+ sum(p.iQuantity) iQuantity,
|
|
|
+ sum(p.iReceivedQTY) iReceivedQTY,
|
|
|
+ sum(p.coefficient) coefficient
|
|
|
+ from(
|
|
|
+ select
|
|
|
+ cDepname cDepCode,
|
|
|
month(dArriveDate) arriveMonth,
|
|
|
- sum(iQuantity) iQuantity,
|
|
|
- sum(iReceivedQTY) iReceivedQTY,
|
|
|
- sum(cast(isnull(cInvDefine1,'0') as decimal)) coefficient
|
|
|
+ iQuantity,
|
|
|
+ iReceivedQTY,
|
|
|
+ cast(isnull(cInvDefine1,'0') as decimal) coefficient
|
|
|
from PO_Pomain
|
|
|
left join PO_Podetails on PO_Podetails.POID=PO_Pomain.POID
|
|
|
left join Department on Department.cdepcode=PO_Pomain.cDepCode
|
|
@@ -164,39 +142,13 @@
|
|
|
left join Vendor on Vendor.cVenCode=PO_Pomain.cVenCode
|
|
|
left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
left join Inventory on PO_Podetails.cInvCode=Inventory.cInvCode
|
|
|
- group by cDepname,month(dArriveDate)
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
- <!--以下为委外导出-->
|
|
|
- <select id="excel4" resultMap="getSupplierCapacity">
|
|
|
- --部门 供应商 月份 数量 累计入库数量 能耗(能耗相加的汇总)
|
|
|
- select ROW_NUMBER() OVER(ORDER BY cVenName) index1,
|
|
|
- cDepname cDepCode,
|
|
|
- cVenName cVenCode,
|
|
|
- month(dArriveDate) arriveMonth,
|
|
|
- sum(iQuantity) iQuantity,
|
|
|
- sum(iReceivedQTY) iReceivedQTY,
|
|
|
- sum(cast(isnull(cInvDefine1,'0') as decimal)) coefficient
|
|
|
- from OM_MOMain
|
|
|
- left join OM_MODetails on OM_MODetails.moid=OM_MOMain.moid
|
|
|
- left join Department on Department.cdepcode=OM_MOMain.cDepCode
|
|
|
- left join Person on Person.cPersonCode=OM_MOMain.cPersonCode
|
|
|
- left join Vendor on Vendor.cVenCode=OM_MOMain.cVenCode
|
|
|
- left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
- left join Inventory on OM_MODetails.cInvCode=Inventory.cInvCode
|
|
|
- group by cVenName,cDepname,month(dArriveDate)
|
|
|
-
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="excel5" resultMap="getSupplierCapacity">
|
|
|
- --供应商 月份 数量 累计入库数量 能耗
|
|
|
- select ROW_NUMBER() OVER(ORDER BY cVenName) index1,
|
|
|
- cVenName cVenCode,
|
|
|
+ UNION
|
|
|
+ select
|
|
|
+ cDepname cDepCode,
|
|
|
month(dArriveDate) arriveMonth,
|
|
|
- sum(iQuantity) iQuantity,
|
|
|
- sum(iReceivedQTY) iReceivedQTY,
|
|
|
- sum(cast(isnull(cInvDefine1,'0') as decimal)) coefficient
|
|
|
+ iQuantity,
|
|
|
+ iReceivedQTY,
|
|
|
+ cast(isnull(cInvDefine1,'0') as decimal) coefficient
|
|
|
from OM_MOMain
|
|
|
left join OM_MODetails on OM_MODetails.moid=OM_MOMain.moid
|
|
|
left join Department on Department.cdepcode=OM_MOMain.cDepCode
|
|
@@ -204,25 +156,52 @@
|
|
|
left join Vendor on Vendor.cVenCode=OM_MOMain.cVenCode
|
|
|
left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
left join Inventory on OM_MODetails.cInvCode=Inventory.cInvCode
|
|
|
- group by cVenName,month(dArriveDate)
|
|
|
+ )p
|
|
|
+ group by p.cDepCode,p.arriveMonth
|
|
|
+ order by p.cDepCode,p.arriveMonth
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <select id="excel6" resultMap="getSupplierCapacity">
|
|
|
- --部门 月份 数量 累计入库数量 能耗
|
|
|
- select ROW_NUMBER() OVER(ORDER BY cDepname) index1,
|
|
|
- cDepname cDepCode,
|
|
|
- month(dArriveDate) arriveMonth,
|
|
|
- sum(iQuantity) iQuantity,
|
|
|
- sum(iReceivedQTY) iReceivedQTY,
|
|
|
- sum(cast(isnull(cInvDefine1,'0') as decimal)) coefficient
|
|
|
- from OM_MOMain
|
|
|
- left join OM_MODetails on OM_MODetails.moid=OM_MOMain.moid
|
|
|
- left join Department on Department.cdepcode=OM_MOMain.cDepCode
|
|
|
- left join Person on Person.cPersonCode=OM_MOMain.cPersonCode
|
|
|
- left join Vendor on Vendor.cVenCode=OM_MOMain.cVenCode
|
|
|
- left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
- left join Inventory on OM_MODetails.cInvCode=Inventory.cInvCode
|
|
|
- group by cDepname,month(dArriveDate)
|
|
|
+ <select id="excel003" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacityVo3">
|
|
|
+ --供应商 月份 数量 累计入库数量 能耗(能耗相加的汇总)
|
|
|
+ select
|
|
|
+ p.cVenCode,
|
|
|
+ p.arriveMonth,
|
|
|
+ sum(p.iQuantity) iQuantity,
|
|
|
+ sum(p.iReceivedQTY) iReceivedQTY,
|
|
|
+ sum(p.coefficient) coefficient
|
|
|
+ from(
|
|
|
+ select ROW_NUMBER() OVER(ORDER BY cVenName) index1,
|
|
|
+ cVenName cVenCode,
|
|
|
+ month(dArriveDate) arriveMonth,
|
|
|
+ iQuantity iQuantity,
|
|
|
+ iReceivedQTY iReceivedQTY,
|
|
|
+ cast(isnull(cInvDefine1,'0') as decimal) coefficient
|
|
|
+ from PO_Pomain
|
|
|
+ left join PO_Podetails on PO_Podetails.POID=PO_Pomain.POID
|
|
|
+ left join Department on Department.cdepcode=PO_Pomain.cDepCode
|
|
|
+ left join Person on Person.cPersonCode=PO_Pomain.cPersonCode
|
|
|
+ left join Vendor on Vendor.cVenCode=PO_Pomain.cVenCode
|
|
|
+ left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
+ left join Inventory on PO_Podetails.cInvCode=Inventory.cInvCode
|
|
|
+ union
|
|
|
+ select ROW_NUMBER() OVER(ORDER BY cVenName) index1,
|
|
|
+ cVenName cVenCode,
|
|
|
+ month(dArriveDate) arriveMonth,
|
|
|
+ iQuantity iQuantity,
|
|
|
+ iReceivedQTY iReceivedQTY,
|
|
|
+ cast(isnull(cInvDefine1,'0') as decimal) coefficient
|
|
|
+ from OM_MOMain
|
|
|
+ left join OM_MODetails on OM_MODetails.moid=OM_MOMain.moid
|
|
|
+ left join Department on Department.cdepcode=OM_MOMain.cDepCode
|
|
|
+ left join Person on Person.cPersonCode=OM_MOMain.cPersonCode
|
|
|
+ left join Vendor on Vendor.cVenCode=OM_MOMain.cVenCode
|
|
|
+ left join VendorClass on VendorClass.cVCCode=Vendor.cVCCode
|
|
|
+ left join Inventory on OM_MODetails.cInvCode=Inventory.cInvCode
|
|
|
+ )p group by p.cVenCode,p.arriveMonth
|
|
|
+ order by p.cVenCode,p.arriveMonth
|
|
|
+
|
|
|
+
|
|
|
</select>
|
|
|
+
|
|
|
</mapper>
|