|
@@ -1,7 +1,7 @@
|
|
|
<?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.DyeLossMapper">
|
|
|
- <select id="select" resultType="org.jeecg.modules.scas.entity.DyeLoss" parameterType="org.jeecg.modules.scas.dto.DyeLossDto">
|
|
|
+ <select id="querySelect" resultType="org.jeecg.modules.scas.entity.DyeLoss" parameterType="org.jeecg.modules.scas.dto.DyeLossDto">
|
|
|
select * from
|
|
|
(select ROW_NUMBER() OVER(ORDER BY OM_MOMain.moid) index1,
|
|
|
Inventory.cinvcode,--物料编码
|
|
@@ -35,17 +35,17 @@
|
|
|
<if test="true">
|
|
|
and Vendor.cVCCode='0105'--染厂
|
|
|
</if>
|
|
|
- <if test="cCode!=null">
|
|
|
- and cCode=#{cCode} -- 订单号
|
|
|
+ <if test="code!=null">
|
|
|
+ and cCode=#{code} -- 订单号
|
|
|
</if>
|
|
|
- <if test="cVenName!=null">
|
|
|
- and cVenName=#{cVenName} -- 供应商名称
|
|
|
+ <if test="venName!=null">
|
|
|
+ and cVenName=#{venName} -- 供应商名称
|
|
|
</if>
|
|
|
- <if test="iOrderType!=null">
|
|
|
- and iOrderType=#{iOrderType} --订单类型
|
|
|
+ <if test="orderType!=null">
|
|
|
+ and iOrderType=#{orderType} --订单类型
|
|
|
</if>
|
|
|
- <if test="cPlanLotNumber!=null">
|
|
|
- and cPlanLotNumber=#{cPlanLotNumber} --计划单号
|
|
|
+ <if test="planLotNumber!=null">
|
|
|
+ and cPlanLotNumber=#{planLotNumber} --计划单号
|
|
|
</if>
|
|
|
<if test="isosid!=null">
|
|
|
and isosid=#{isosid} --销售订单号
|
|
@@ -55,6 +55,35 @@
|
|
|
where p.index1>=${pageNo*pageSize-pageSize} and p.index1<=${pageSize*pageNo}
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectPage" resultType="org.jeecg.modules.scas.entity.DyeLoss" >
|
|
|
+ select
|
|
|
+ d.cinvcode,--物料编码
|
|
|
+ d.cInvName,--物料名称
|
|
|
+ b.cfree1 color,--颜色
|
|
|
+ cVenName cVenName,--供应商
|
|
|
+ a.cCode cCode,--订单号
|
|
|
+ b.iQuantity,--订单数量
|
|
|
+
|
|
|
+ iReceivedQTY iQuantity2,--采购入库数
|
|
|
+
|
|
|
+ iMaterialSendQty iQuantity3,--材料出库数
|
|
|
+
|
|
|
+ (select sum(OM_MatSettleVouchs.iMSQuantity) from OM_MatSettleVouch
|
|
|
+ left join OM_MatSettleVouchs on OM_MatSettleVouchs.msid=OM_MatSettleVouch.msid
|
|
|
+ where b.MODetailsID=OM_MatSettleVouch.modetailsid) iMSQuantity,--核销数量
|
|
|
+
|
|
|
+ (1-iReceivedQTY/NULLIF((select sum(OM_MatSettleVouchs.iMSQuantity) from OM_MatSettleVouch
|
|
|
+ left join OM_MatSettleVouchs on OM_MatSettleVouchs.msid=OM_MatSettleVouch.msid
|
|
|
+ where b.MODetailsID=OM_MatSettleVouch.modetailsid),0))*100 dyeLossRate--染损
|
|
|
+
|
|
|
+ from OM_MOMain a
|
|
|
+ left join OM_MODetails b on b.moid=a.moid
|
|
|
+ left join Vendor c on c.cVenCode=a.cVenCode
|
|
|
+ left join Inventory d on b.cInvCode=d.cInvCode
|
|
|
+ left join SO_SODetails e on e.iSOsID =b.iSOsID
|
|
|
+ ${ew.customSqlSegment} and c.cVCCode='0105' --染厂
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="selectSum" resultType="org.jeecg.modules.scas.entity.DyeLoss">
|
|
|
--染损报表合计
|
|
|
select sum(OM_MODetails.iQuantity) iQuantity2,
|
|
@@ -71,23 +100,47 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectVendor" resultType="org.jeecg.modules.scas.entity.DyeLoss" parameterType="java.lang.String">--选择供应商按物料分组展现每个物料的染损
|
|
|
- select Inventory.cInvName,--物料名称
|
|
|
+ /*select Inventory.cInvName,--物料名称
|
|
|
sum(1-(iReceivedQTY/iMSQuantity)) dyeLossRate--核销数量
|
|
|
+ sum(iMSQuantity) iMSQuantity,--核销数量
|
|
|
+ sum(1-(iReceivedQTY/iMSQuantity)) dyeLossRate--染损
|
|
|
from OM_MOMain
|
|
|
left join OM_MODetails on OM_MODetails.moid=OM_MOMain.moid
|
|
|
left join Vendor on Vendor.cVenCode=OM_MOMain.cVenCode
|
|
|
left join Inventory on OM_MODetails.cInvCode=Inventory.cInvCode
|
|
|
- left join OM_MatSettleVouch on OM_MOMain.cCode=OM_MatSettleVouch.cMOCode
|
|
|
+ left join OM_MatSettleVouch on OM_MOMain.cCode=OM_MatSettleVouch.cMOCode
|
|
|
+ left join OM_MatSettleVouchs on OM_MatSettleVouchs.msid=OM_MatSettleVouch.msid
|
|
|
+ where Vendor.cVCCode='0105'
|
|
|
+ AND cVenName=#{value}
|
|
|
+ GROUP BY Inventory.cInvName*/
|
|
|
+
|
|
|
+ select
|
|
|
+ cInvName,--物料名称
|
|
|
+ iQuantity2,--入库数量
|
|
|
+ iMSQuantity,--核销数量
|
|
|
+ (1-(iQuantity2/iMSQuantity)) dyeLossRate
|
|
|
+ from
|
|
|
+ (select Inventory.cInvName,--物料名称
|
|
|
+ sum(iReceivedQTY) iQuantity2,--入库数量
|
|
|
+ sum(iMSQuantity) iMSQuantity,--核销数量
|
|
|
+ sum(1-(iReceivedQTY/iMSQuantity)) dyeLossRate--染损
|
|
|
+ from OM_MOMain
|
|
|
+ left join OM_MODetails on OM_MODetails.moid=OM_MOMain.moid
|
|
|
+ left join Vendor on Vendor.cVenCode=OM_MOMain.cVenCode
|
|
|
+ left join Inventory on OM_MODetails.cInvCode=Inventory.cInvCode
|
|
|
+ left join OM_MatSettleVouch on OM_MOMain.cCode=OM_MatSettleVouch.cMOCode
|
|
|
left join OM_MatSettleVouchs on OM_MatSettleVouchs.msid=OM_MatSettleVouch.msid
|
|
|
where Vendor.cVCCode='0105'
|
|
|
AND cVenName=#{value}
|
|
|
- GROUP BY Inventory.cInvName
|
|
|
+ GROUP BY Inventory.cInvName)p
|
|
|
+
|
|
|
+
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="selectCInvName" resultType="org.jeecg.modules.scas.entity.DyeLoss">--按供应商分组展现每个供应商的染损
|
|
|
- select cVenName,--供应商名称
|
|
|
+ /*select cVenName,--供应商名称
|
|
|
sum(iReceivedQTY) iQuantity2,--入库数量
|
|
|
sum(iMSQuantity) iMSQuantity,--核销数量
|
|
|
sum(1-(iReceivedQTY/iMSQuantity)) dyeLossRate--染损
|
|
@@ -98,7 +151,25 @@
|
|
|
left join OM_MatSettleVouch on OM_MOMain.cCode=OM_MatSettleVouch.cMOCode
|
|
|
left join OM_MatSettleVouchs on OM_MatSettleVouchs.msid=OM_MatSettleVouch.msid
|
|
|
where Vendor.cVCCode='0105'
|
|
|
- GROUP BY cVenName
|
|
|
+ GROUP BY cVenName*/
|
|
|
+ select cVenName,--供应商名称
|
|
|
+ iQuantity2,--入库数量
|
|
|
+ iMSQuantity,--核销数量
|
|
|
+ (1-(iQuantity2/iMSQuantity)) dyeLossRate
|
|
|
+ from (
|
|
|
+ select
|
|
|
+ cVenName,--供应商名称
|
|
|
+ sum(iReceivedQTY) iQuantity2,--入库数量
|
|
|
+ sum(iMSQuantity) iMSQuantity,--核销数量
|
|
|
+ sum(1-(iReceivedQTY/iMSQuantity)) dyeLossRate--染损
|
|
|
+ from OM_MOMain
|
|
|
+ left join OM_MODetails on OM_MODetails.moid=OM_MOMain.moid
|
|
|
+ left join Vendor on Vendor.cVenCode=OM_MOMain.cVenCode
|
|
|
+ left join Inventory on OM_MODetails.cInvCode=Inventory.cInvCode
|
|
|
+ left join OM_MatSettleVouch on OM_MOMain.cCode=OM_MatSettleVouch.cMOCode
|
|
|
+ left join OM_MatSettleVouchs on OM_MatSettleVouchs.msid=OM_MatSettleVouch.msid
|
|
|
+ where Vendor.cVCCode='0105'
|
|
|
+ GROUP BY cVenName) p
|
|
|
</select>
|
|
|
|
|
|
|