瀏覽代碼

染损报表

huxy 2 年之前
父節點
當前提交
2aff2c4bda

+ 5 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/scas/controller/DyeLossController.java

@@ -54,22 +54,22 @@ public class DyeLossController extends JeecgController<DyeLoss, IDyeLossService>
         Result<IPage<DyeLoss>> result = new Result<IPage<DyeLoss>>();
         QueryWrapper<DyeLossDto> queryWrapper = new QueryWrapper<>();//初始化
         queryWrapper.eq("c.cVCCode","0105");//确定为染厂
-        queryWrapper.eq("g.cRdBusType","委外发料");//选择为材料出库单
+        /*queryWrapper.eq("g.cRdBusType","委外发料");//选择为材料出库单*/
         if(dyeLossDto.getCode()!=null&& !dyeLossDto.getCode().trim().equals("") &&StringUtils.isNotBlank(dyeLossDto.getCode())){
             queryWrapper.eq("a.cCode",dyeLossDto.getCode());//订单号
         }
         if(dyeLossDto.getVenName()!=null && !dyeLossDto.getVenName().trim().equals("") &&StringUtils.isNotBlank(dyeLossDto.getVenName())){
             queryWrapper.eq("c.cVenName",dyeLossDto.getVenName());//供应商名称
         }
-        if(dyeLossDto.getOrderType()!=null && !dyeLossDto.getOrderType().trim().equals("") &&StringUtils.isNotBlank(dyeLossDto.getOrderType())){
+        /*if(dyeLossDto.getOrderType()!=null && !dyeLossDto.getOrderType().trim().equals("") &&StringUtils.isNotBlank(dyeLossDto.getOrderType())){
             queryWrapper.eq("a.iOrderType",dyeLossDto.getOrderType());//订单类型
-        }
+        }*/
         if(dyeLossDto.getPlanLotNumber()!=null && !dyeLossDto.getPlanLotNumber().trim().equals("") &&StringUtils.isNotBlank(dyeLossDto.getPlanLotNumber())){
             queryWrapper.eq("left(a.cCode,ISNULL(NULLIF(CHARINDEX('-',a.cCode)-1,-1),len(a.cCode)))",dyeLossDto.getPlanLotNumber());//计划单号
         }
-        if(dyeLossDto.getCsocode()!=null && !dyeLossDto.getCsocode().trim().equals("") &&StringUtils.isNotBlank(dyeLossDto.getCsocode())){
+        /*if(dyeLossDto.getCsocode()!=null && !dyeLossDto.getCsocode().trim().equals("") &&StringUtils.isNotBlank(dyeLossDto.getCsocode())){
             queryWrapper.eq("b.csoordercode ",dyeLossDto.getCsocode());//销售订单号
-        }
+        }*/
         Page<DyeLoss> page = new Page<DyeLoss>(pageNo, pageSize);
         IPage<DyeLoss> pageList = dyeLossService.selectPage(page, queryWrapper);
         result.setSuccess(true);

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/scas/dto/DyeLossDto.java

@@ -12,14 +12,14 @@ public class DyeLossDto {
     @ApiModelProperty(value = "供应商名称")
     private String venName;//供应商名称
 
-    @ApiModelProperty(value = "订单类型")
-    private String orderType;//订单类型
+   /* @ApiModelProperty(value = "订单类型")
+    private String orderType;//订单类型*/
 
     @ApiModelProperty(value = "计划单号")
     private String planLotNumber;//计划单号
 
-    @ApiModelProperty(value = "销售订单号")
-    private String csocode;//销售订单号
+   /* @ApiModelProperty(value = "销售订单号")
+    private String csocode;//销售订单号*/
 
     /*@ApiModelProperty(value = "当前页面")
     private Integer pageNo=1;//当前页面

+ 33 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/scas/mapper/xml/DyeLossMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="org.jeecg.modules.scas.mapper.DyeLossMapper">
 
     <select id="selectPage" resultType="org.jeecg.modules.scas.entity.DyeLoss" >
-     select
+     /*select
         d.cinvcode,--物料编码
         d.cInvName,--物料名称
         b.cfree1 color,--颜色
@@ -18,9 +18,30 @@
         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
+        left join SO_SODetails e on e.iSOsID =b.iSOsID
         left join OM_MatSettleVouch f on  b.MODetailsID =f.MODetailsID
-        left join OM_MatSettleVouchs g on g.msid=f.msid
+        left join OM_MatSettleVouchs g on g.msid=f.msid*/
+
+    select
+        d.cinvcode,--物料编码
+        d.cInvName,--物料名称
+        b.cfree1 color,--颜色
+        cVenName cVenName,--供应商
+        a.cCode cCode,--订单号
+        b.iQuantity,--订单数量
+        ISNULL(iReceivedQTY, 0 ) iQuantity2,--采购入库数
+        ISNULL(iMaterialSendQty, 0 ) iQuantity3,--材料出库数
+        ISNULL((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)iMSQuantity,--核销数量
+        ISNULL( (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,0) 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}
     </select>
 
@@ -77,19 +98,21 @@
         b.cfree1 color,--颜色
         cVenName cVenName,--供应商
         a.cCode cCode,--订单号
-        b.iQuantity iQuantity,--订单数量
+        b.iQuantity,--订单数量
         ISNULL(iReceivedQTY, 0 ) iQuantity2,--采购入库数
         ISNULL(iMaterialSendQty, 0 ) iQuantity3,--材料出库数
-        ISNULL(g.iMSQuantity, 0 ) iMSQuantity,--核销数量
-        ISNULL((1-iReceivedQTY/NULLIF(g.iMSQuantity,0))*100,0) dyeLossRate--染损
+        ISNULL((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)iMSQuantity,--核销数量
+        ISNULL( (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,0) 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
-        left join OM_MatSettleVouch f on  b.MODetailsID =f.MODetailsID
-        left join OM_MatSettleVouchs g on g.msid=f.msid
-        where c.cVCCode='0105' and  g.cRdBusType='委外发料'
+        --left join SO_SODetails e on e.iSOsID =b.iSOsID
+        where c.cVCCode='0105'
     </select>
 
 

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/scas/service/IDyeLossService.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.scas.service;
 
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -12,12 +13,16 @@ import java.util.List;
 
 public interface IDyeLossService extends IService<DyeLoss> {
 
+    @DS("multi-three")
     IPage<DyeLoss> selectPage(IPage<DyeLoss> page, QueryWrapper<DyeLossDto> queryWrapper);
 
+    @DS("multi-three")
     List<DyeLoss> selectVendor(String name);
 
+    @DS("multi-three")
     List<DyeLoss> selectCInvName();
 
+    @DS("multi-three")
     List<DyeLoss> excel();
 
 }