huxy 2 роки тому
батько
коміт
02688ccaab

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

@@ -2,9 +2,14 @@ package org.jeecg.modules.scas.controller;
 
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.modules.scas.dto.DyeLossDto;
@@ -13,9 +18,11 @@ import org.jeecg.modules.scas.service.IDyeLossService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.ModelAndView;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 
@@ -34,32 +41,66 @@ public class DyeLossController extends JeecgController<DyeLoss, IDyeLossService>
     @Autowired
     private IDyeLossService dyeLossService;
 
-    @AutoLog(value = "染损报表查询")
+    //Result<IPage<DyeLoss>>
+    /*@AutoLog(value = "染损报表查询")
     @ApiOperation(value="染损报表查询", notes="染损报表查询")
     @RequestMapping(value = "/list",method = RequestMethod.GET)
     public List<DyeLoss> list(DyeLossDto dyeLossDto){
         return dyeLossService.select(dyeLossDto);
+    }*/
+
+    @AutoLog(value = "染损报表查询")
+    @ApiOperation(value="染损报表查询", notes="染损报表查询")
+    @RequestMapping(value = "/list",method = RequestMethod.GET)
+    public Result<IPage<DyeLoss>> list2(DyeLossDto dyeLossDto, HttpServletRequest req){
+        if(dyeLossDto.getPageSize()>10){//页面长度不能大于10
+            dyeLossDto.setPageSize(10);
+        }
+        Result<IPage<DyeLoss>> result = new Result<IPage<DyeLoss>>();
+        QueryWrapper<DyeLossDto> queryWrapper = new QueryWrapper<>();//初始化
+        System.out.println("pageno"+dyeLossDto.getPageNo()+"pagesize"+dyeLossDto.getPageSize());
+        if(StringUtils.isNotBlank(dyeLossDto.getCode())){ //code;//订单号
+            queryWrapper.eq("a.cCode",dyeLossDto.getCode());
+        }
+        if(StringUtils.isNotBlank(dyeLossDto.getVenName())){//供应商名称
+            queryWrapper.eq("c.cVenName",dyeLossDto.getVenName());
+        }
+        if(StringUtils.isNotBlank(dyeLossDto.getOrderType())){//订单类型
+            queryWrapper.eq("a.iOrderType",dyeLossDto.getOrderType());
+        }
+        if(StringUtils.isNotBlank(dyeLossDto.getPlanLotNumber())){//计划单号
+            queryWrapper.eq("b.cPlanLotNumber",dyeLossDto.getPlanLotNumber());
+        }
+        if(StringUtils.isNotBlank(dyeLossDto.getCsocode())){//销售订单号
+            queryWrapper.eq("e.csocode",dyeLossDto.getCsocode());
+        }
+        Page<DyeLoss> page = new Page<DyeLoss>(dyeLossDto.getPageNo(), dyeLossDto.getPageSize());
+        IPage<DyeLoss> pageList = dyeLossService.selectPage(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        result.setMessage("查询成功");
+        return result;
     }
 
     @AutoLog(value = "染损报表数据合计")
     @ApiOperation(value="染损报表数据合计", notes="染损报表数据合计")
     @RequestMapping(value = "/selectSum",method = RequestMethod.GET)
-    public List<DyeLoss> selectSum(){
-        return dyeLossService.selectSum();
+    public Result<?> selectSum(){
+        return Result.ok(dyeLossService.selectSum());
     }
 
     @AutoLog(value = "按供应商名称按物料分组展现每个物料的染损")
     @ApiOperation(value="按供应商名称按物料分组展现每个物料的染损", notes="按供应商名称按物料分组展现每个物料的染损")
     @RequestMapping(value = "/vendor",method = RequestMethod.GET)
-    public List<DyeLoss> vendor(String name){
-        return dyeLossService.selectVendor(name);
+    public Result<?> vendor(@RequestParam(name="venName") String venName){
+        return Result.ok(dyeLossService.selectVendor(venName));
     }
 
     @AutoLog(value = "按供应商分组展现每个供应商的染损")
     @ApiOperation(value="按供应商分组展现每个供应商的染损", notes="按供应商分组展现每个供应商的染损")
     @RequestMapping(value = "/cInvName",method = RequestMethod.GET)
-    public List<DyeLoss> cInvName(){
-        return dyeLossService.selectCInvName();
+    public Result<?> cInvName(){
+        return Result.ok(dyeLossService.selectCInvName());
     }
 
     @AutoLog(value = "染损报表导出")

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

@@ -1,16 +1,30 @@
 package org.jeecg.modules.scas.dto;
 
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 @Data
 public class DyeLossDto {
-    private String cCode;//订单号
-    private String cVenName;//供应商名称
-    private String iOrderType;//订单类型
-    private String cPlanLotNumber;//计划单号
-    private String isosid;//销售订单号
-
-    private Integer pageNo=1;//当前页
-    private Integer pageSize=20;//页面大小
+    @ApiModelProperty(value = "订单号")
+    private String code;//订单号
+
+    @ApiModelProperty(value = "供应商名称")
+    private String venName;//供应商名称
+
+    @ApiModelProperty(value = "订单类型")
+    private String orderType;//订单类型
+
+    @ApiModelProperty(value = "计划单号")
+    private String planLotNumber;//计划单号
+
+    @ApiModelProperty(value = "销售订单号")
+    private String csocode;//销售订单号
+
+    @ApiModelProperty(value = "当前页面")
+    private Integer pageNo=1;//当前页面
+
+    @ApiModelProperty(value = "页面大小")
+    private Integer pageSize=10;//页面大小
 
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/scas/entity/DyeLoss.java

@@ -1,11 +1,13 @@
 package org.jeecg.modules.scas.entity;
 
+import io.swagger.annotations.ApiModel;
 import lombok.Data;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.math.BigDecimal;
 
 @Data
+@ApiModel(description="染损报表")
 public class DyeLoss {
     @Excel(name = "物料编码", width = 15)
     private String cInvCode;//物料编码

+ 7 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/scas/mapper/DyeLossMapper.java

@@ -1,19 +1,22 @@
 package org.jeecg.modules.scas.mapper;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.scas.dto.DyeLossDto;
 import org.jeecg.modules.scas.entity.DyeLoss;
 
 import java.util.List;
 
 /**
- * @Description: 供应商产能报表
+ * @Description: 染损报表
  * @Author: jeecg-boot
  * @Date:   2022-04-12
  * @Version: V1.0
  */
 public interface DyeLossMapper extends BaseMapper<DyeLoss> {
-    List<DyeLoss> select(DyeLossDto dyeLossDto);
+    List<DyeLoss> querySelect(DyeLossDto dyeLossDto);
 
     List<DyeLoss> selectSum();
 
@@ -22,4 +25,6 @@ public interface DyeLossMapper extends BaseMapper<DyeLoss> {
     List<DyeLoss> selectCInvName();
 
     List<DyeLoss> excel();
+
+    IPage<DyeLoss> selectPage(IPage<DyeLoss> page, @Param("ew") QueryWrapper<DyeLossDto> queryWrapper);
 }

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

@@ -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&gt;=${pageNo*pageSize-pageSize} and p.index1&lt;=${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>
 
 

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

@@ -1,7 +1,10 @@
 package org.jeecg.modules.scas.service;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.scas.dto.DyeLossDto;
 import org.jeecg.modules.scas.entity.DyeLoss;
 
@@ -18,4 +21,6 @@ public interface IDyeLossService extends IService<DyeLoss> {
     List<DyeLoss> selectCInvName();
 
     List<DyeLoss> excel();
+
+    IPage<DyeLoss> selectPage(IPage<DyeLoss> page,QueryWrapper<DyeLossDto> queryWrapper);
 }

+ 8 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/scas/service/impl/DyeLossServiceImpl.java

@@ -2,6 +2,8 @@ package org.jeecg.modules.scas.service.impl;
 
 
 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.impl.ServiceImpl;
 import org.jeecg.modules.scas.dto.DyeLossDto;
 import org.jeecg.modules.scas.entity.DyeLoss;
@@ -21,7 +23,7 @@ public class DyeLossServiceImpl extends ServiceImpl<DyeLossMapper, DyeLoss> impl
 
     @DS("multi-one")
     public List<DyeLoss> select(DyeLossDto dyeLossDto) {
-        return dyeLossMapper.select(dyeLossDto);
+        return dyeLossMapper.querySelect(dyeLossDto);
     }
 
     @DS("multi-one")
@@ -43,4 +45,9 @@ public class DyeLossServiceImpl extends ServiceImpl<DyeLossMapper, DyeLoss> impl
     public List<DyeLoss> excel() {
         return dyeLossMapper.excel();
     }
+
+    @DS("multi-one")
+    public IPage<DyeLoss> selectPage(IPage<DyeLoss> page, QueryWrapper<DyeLossDto> queryWrapper) {
+        return dyeLossMapper.selectPage(page,queryWrapper);
+    }
 }