Browse Source

生产进度报表

zengtx 2 years ago
parent
commit
70216c07fc

+ 28 - 32
jeecg-boot-module-system/src/main/java/org/jeecg/modules/productionScheduleReport/controller/ProductionScheduleController.java

@@ -38,6 +38,7 @@ public class ProductionScheduleController {
     @ApiOperation(value="生产进度报表-分页列表查询", notes="生产进度报表-分页列表查询")
     @ApiOperation(value="生产进度报表-分页列表查询", notes="生产进度报表-分页列表查询")
     @GetMapping(value = "/list")
     @GetMapping(value = "/list")
     public Result<IPage<ProductionSchedule>> queryPageList(ProductionSchedule productionSchedule,String dPreDateB,String dPreDateE,
     public Result<IPage<ProductionSchedule>> queryPageList(ProductionSchedule productionSchedule,String dPreDateB,String dPreDateE,
+                                                            String dDateB,String dDateE,
                                                             @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                                             @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                                             @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                                             @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                                             HttpServletRequest req) {
                                                             HttpServletRequest req) {
@@ -48,29 +49,29 @@ public class ProductionScheduleController {
         QueryWrapper<ProductionSchedule> queryWrapper = new QueryWrapper<>();
         QueryWrapper<ProductionSchedule> queryWrapper = new QueryWrapper<>();
 
 
             if(StringUtils.isNotBlank(productionSchedule.getCSOCode())){//销售订单号
             if(StringUtils.isNotBlank(productionSchedule.getCSOCode())){//销售订单号
-                queryWrapper.eq("ss.cSOCode",productionSchedule.getCSOCode());
+                queryWrapper.eq("ss.csocode",productionSchedule.getCSOCode());
+            }
+            if(StringUtils.isNotBlank(productionSchedule.getCDepName())){//部门
+                queryWrapper.eq("c.cDepName",productionSchedule.getCDepName());
+            }
+            if(StringUtils.isNotBlank(productionSchedule.getCInvName())){//物料名称
+                queryWrapper.eq("f.cInvName",productionSchedule.getCInvName());
+            }
+            if(StringUtils.isNotBlank(productionSchedule.getCDefine12())){//成衣加工厂
+                queryWrapper.eq("v.cVenName",productionSchedule.getCDefine12());
+            }
+            if(StringUtils.isNotBlank(productionSchedule.getCPersonName())){//业务员
+                queryWrapper.eq("d.cPersonName",productionSchedule.getCPersonName());
+            }
+            if(StringUtils.isNotBlank(productionSchedule.getPlanCode())){//计划单号
+                queryWrapper.eq("o.omCode",productionSchedule.getPlanCode());
+            }
+            if(StringUtils.isNotBlank(dDateB)){//订单日期
+                queryWrapper.between("ss.dDate",dDateB,dDateE);
+            }
+            if(StringUtils.isNotBlank(productionSchedule.getItemNumber())){//款号 item_number
+                queryWrapper.eq("s.cdefine22",productionSchedule.getItemNumber());
             }
             }
-//            if(StringUtils.isNotBlank(productionSchedule.getCDepName())){//部门
-//                queryWrapper.eq("c.cDepName",productionSchedule.getCDepName());
-//            }
-//            if(StringUtils.isNotBlank(productionSchedule.getCInvName())){//物料名称
-//                queryWrapper.eq("f.cInvName",productionSchedule.getCInvName());
-//            }
-//            if(StringUtils.isNotBlank(productionSchedule.getCDefine12())){//成衣加工厂
-//                queryWrapper.eq("a.cDefine12",productionSchedule.getCDefine12());
-//            }
-//            if(StringUtils.isNotBlank(productionSchedule.getCPersonName())){//业务员
-//                queryWrapper.eq("d.cPersonName",productionSchedule.getCPersonName());
-//            }
-//            if(StringUtils.isNotBlank(productionSchedule.getCSOCode())){//计划单号
-//                queryWrapper.eq("a.cSOCode",productionSchedule.getCSOCode());
-//            }
-//            if(StringUtils.isNotBlank(productionSchedule.getDDate())){//订单日期
-//                queryWrapper.eq("CONVERT(nvarchar(10),a.dDate,121)",productionSchedule.getDDate());
-//            }
-//            if(StringUtils.isNotBlank(productionSchedule.getColor())){//颜色
-//                queryWrapper.eq("b.cFree1",productionSchedule.getColor());
-//            }
             if(StringUtils.isNotBlank(dPreDateB)){//交期
             if(StringUtils.isNotBlank(dPreDateB)){//交期
                 queryWrapper.between("s.dPreDate",dPreDateB,dPreDateE);
                 queryWrapper.between("s.dPreDate",dPreDateB,dPreDateE);
              }
              }
@@ -108,16 +109,11 @@ public class ProductionScheduleController {
     public Result<ProductionSchedule> getView(String soCode){
     public Result<ProductionSchedule> getView(String soCode){
         Result<ProductionSchedule> result = new Result<ProductionSchedule>();
         Result<ProductionSchedule> result = new Result<ProductionSchedule>();
 
 
-        QueryWrapper<ProductionSchedule> queryWrapper = new QueryWrapper<>();
-        if(StringUtils.isBlank(soCode)){//销售订单号
-           result.setMessage("销售订单号不能为空");
-           result.setSuccess(false);
-           return result;
-        }else{
-            queryWrapper.eq("ss.cSOCode",soCode);
-        }
+        Page<ProductionSchedule> page = new Page<ProductionSchedule>(1, 2);
 
 
-        ProductionSchedule entity = new ProductionSchedule();
+        QueryWrapper<ProductionSchedule> queryWrapper = new QueryWrapper<>();
+        //queryWrapper.eq("")
+        IPage<ProductionSchedule> pageList = productionScheduleService.selectByPage(page,queryWrapper);
 //        List<ProductionSchedule> list = productionScheduleService.selectByView(queryWrapper); // 详情数据
 //        List<ProductionSchedule> list = productionScheduleService.selectByView(queryWrapper); // 详情数据
 //        if(list.size() > 0){
 //        if(list.size() > 0){
 //            entity = list.get(0);
 //            entity = list.get(0);
@@ -130,7 +126,7 @@ public class ProductionScheduleController {
 //        List<ProductionScheduleWeiWai> selectWeiWai = productionScheduleService.selectWeiWai(planCode);
 //        List<ProductionScheduleWeiWai> selectWeiWai = productionScheduleService.selectWeiWai(planCode);
 //        entity.setProductionScheduleWeiWai(selectWeiWai);
 //        entity.setProductionScheduleWeiWai(selectWeiWai);
 
 
-        result.setResult(entity);
+       // result.setResult(entity);
 
 
         result.setSuccess(true);
         result.setSuccess(true);
         return result;
         return result;

+ 19 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/productionScheduleReport/entity/ProductionSchedule.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.productionScheduleReport.entity;
 
 
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
+import org.jeecg.modules.report.entity.AccessorItem;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -38,23 +39,23 @@ public class ProductionSchedule {
     @ApiModelProperty(value = "订单日期")
     @ApiModelProperty(value = "订单日期")
     private String dDate ;// 订单日期
     private String dDate ;// 订单日期
     @ApiModelProperty(value = "订单数量")
     @ApiModelProperty(value = "订单数量")
-    private String iQuantity ;//订单数量
+    private Double iQuantity ;//订单数量
     @ApiModelProperty(value = "原币含税单价")
     @ApiModelProperty(value = "原币含税单价")
-    private String iTaxUnitPrice ;// 原币含税单价
+    private Double iTaxUnitPrice ;// 原币含税单价
     @ApiModelProperty(value = "总额(原币)")
     @ApiModelProperty(value = "总额(原币)")
-    private String totalSum ;// 总额(原币)
+    private Double totalSum ;// 总额(原币)
     @ApiModelProperty(value = "单价(本币)")
     @ApiModelProperty(value = "单价(本币)")
-    private String bbPrice ;// 单价(本币)
+    private Double bbPrice ;// 单价(本币)
     @ApiModelProperty(value = "总额(本币)")
     @ApiModelProperty(value = "总额(本币)")
-    private String iNatSum ;// 总额(本币)
+    private Double iNatSum ;// 总额(本币)
     @ApiModelProperty(value = "实际发票成本")
     @ApiModelProperty(value = "实际发票成本")
-    private String icostsum ;// 实际发票成本
+    private Double icostsum ;// 实际发票成本
     @ApiModelProperty(value = "已出库数量")
     @ApiModelProperty(value = "已出库数量")
-    private String foutquantity ;//已出库数量
+    private Double foutquantity ;//已出库数量
     @ApiModelProperty(value = "累计开票数量")
     @ApiModelProperty(value = "累计开票数量")
-    private String iKPQuantity ;//累计开票数量
+    private Double iKPQuantity ;//累计开票数量
     @ApiModelProperty(value = "累计开票金额")
     @ApiModelProperty(value = "累计开票金额")
-    private String iKPMoney ;// 累计开票金额
+    private Double iKPMoney ;// 累计开票金额
     @ApiModelProperty(value = "图片id")
     @ApiModelProperty(value = "图片id")
     private String pictureId;//图片id
     private String pictureId;//图片id
     @ApiModelProperty(value = "图片流")
     @ApiModelProperty(value = "图片流")
@@ -63,9 +64,18 @@ public class ProductionSchedule {
     private List<ProductionScheduleWeiWai> productionScheduleWeiWai;
     private List<ProductionScheduleWeiWai> productionScheduleWeiWai;
     @ApiModelProperty(value = "生产进度报表(采购订单数据)")
     @ApiModelProperty(value = "生产进度报表(采购订单数据)")
     private List<ProductionScheduleCaiGou> ProductionScheduleCaiGou;
     private List<ProductionScheduleCaiGou> ProductionScheduleCaiGou;
+    //入库数量
+    private Double finquantity;
+
+    // 销售订单附件
+    List<AccessorItem> accessorItemList;
 
 
 
 
     //查询条件
     //查询条件
     private String stateTime;
     private String stateTime;
     private String endTime;
     private String endTime;
+
+    //账套
+    private String account;
+
 }
 }

+ 9 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/productionScheduleReport/mapper/xml/ProductionScheduleMapper.xml

@@ -5,10 +5,10 @@
     <select id="selectByPage" resultType="org.jeecg.modules.productionScheduleReport.entity.ProductionSchedule">
     <select id="selectByPage" resultType="org.jeecg.modules.productionScheduleReport.entity.ProductionSchedule">
 
 
 select t.* from (
 select t.* from (
-SELECT  max(o.omCode) as planCode,max(c.PictureGUID) as pictureId,
+SELECT  max(o.omCode) as planCode,max(c.PictureGUID) as pictureId,'901' as account,sum(s.finquantity) as finquantity,
         max(ss.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(s.icostsum) as icostsum,
         max(ss.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(s.icostsum) as icostsum,
         max(v.cVenName) as cDefine12,max(s.cInvCode) as cInvCode,max(s.cInvName) as cInvName,max(s.cdefine22) as itemNumber,
         max(v.cVenName) as cDefine12,max(s.cInvCode) as cInvCode,max(s.cInvName) as cInvName,max(s.cdefine22) as itemNumber,
-        max(s.cFree1) as color,max(s.dPreDate) as dPreDateBT,sum(s.iQuantity) as iQuantity,max(s.iTaxUnitPrice) as iTaxUnitPrice,
+        max(s.cFree1) as color,min(s.dPreDate) as dPreDateBT,sum(s.iQuantity) as iQuantity,max(round(s.iTaxUnitPrice,4)) as iTaxUnitPrice,
         sum(s.iSum) as totalSum,max(s.iNatUnitPrice) as bbPrice,max(s.iNatSum) as iNatSum,sum(s.foutquantity) as foutquantity,sum(s.iKPQuantity) as iKPQuantity
         sum(s.iSum) as totalSum,max(s.iNatUnitPrice) as bbPrice,max(s.iNatSum) as iNatSum,sum(s.foutquantity) as foutquantity,sum(s.iKPQuantity) as iKPQuantity
            FROM  UFDATA_901_2021.dbo.SO_SODetails s
            FROM  UFDATA_901_2021.dbo.SO_SODetails s
         inner JOIN UFDATA_901_2021.dbo.SO_SOMain ss on ss.ID= s.ID
         inner JOIN UFDATA_901_2021.dbo.SO_SOMain ss on ss.ID= s.ID
@@ -30,13 +30,13 @@ SELECT  max(o.omCode) as planCode,max(c.PictureGUID) as pictureId,
         inner JOIN UFDATA_901_2021.dbo.Department de ON ss.cDepCode = de.cDepCode
         inner JOIN UFDATA_901_2021.dbo.Department de ON ss.cDepCode = de.cDepCode
         inner JOIN UFDATA_901_2021.dbo.Customer cc ON ss.cCusCode = cc.cCusCode
         inner JOIN UFDATA_901_2021.dbo.Customer cc ON ss.cCusCode = cc.cCusCode
         ${ew.customSqlSegment} and c.cInvCcode like '19%'
         ${ew.customSqlSegment} and c.cInvCcode like '19%'
-         GROUP BY v.cVenName
+         GROUP BY ss.csocode,o.omCode,s.cInvCode,s.cFree1
         union all
         union all
 
 
-        SELECT max(o.omCode) as planCode,max(c.PictureGUID) as pictureId,
+        SELECT max(o.omCode) as planCode,max(c.PictureGUID) as pictureId,'902' as account,sum(s.finquantity) as finquantity,
         max(ss.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(s.icostsum) as icostsum,
         max(ss.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(s.icostsum) as icostsum,
         max(v.cVenName) as cDefine12,max(s.cInvCode) as cInvCode,max(s.cInvName) as cInvName,max(s.cdefine22) as itemNumber,
         max(v.cVenName) as cDefine12,max(s.cInvCode) as cInvCode,max(s.cInvName) as cInvName,max(s.cdefine22) as itemNumber,
-        max(s.cFree1) as color,max(s.dPreDate) as dPreDateBT,sum(s.iQuantity) as iQuantity,max(s.iTaxUnitPrice) as iTaxUnitPrice,
+        max(s.cFree1) as color,min(s.dPreDate) as dPreDateBT,sum(s.iQuantity) as iQuantity,max(round(s.iTaxUnitPrice,4)) as iTaxUnitPrice,
         sum(s.iSum) as totalSum,max(s.iNatUnitPrice) as bbPrice,max(s.iNatSum) as iNatSum,sum(s.foutquantity) as foutquantity,sum(s.iKPQuantity) as iKPQuantity
         sum(s.iSum) as totalSum,max(s.iNatUnitPrice) as bbPrice,max(s.iNatSum) as iNatSum,sum(s.foutquantity) as foutquantity,sum(s.iKPQuantity) as iKPQuantity
         FROM  UFDATA_903_2021.dbo.SO_SODetails a
         FROM  UFDATA_903_2021.dbo.SO_SODetails a
         inner JOIN UFDATA_903_2021.dbo.SO_SOMain b on b.ID= a.ID
         inner JOIN UFDATA_903_2021.dbo.SO_SOMain b on b.ID= a.ID
@@ -64,14 +64,14 @@ SELECT  max(o.omCode) as planCode,max(c.PictureGUID) as pictureId,
         inner JOIN UFDATA_902_2021.dbo.Customer cu ON ss.cCusCode = cu.cCusCode
         inner JOIN UFDATA_902_2021.dbo.Customer cu ON ss.cCusCode = cu.cCusCode
         ${ew.customSqlSegment} and  cc.cCusCode in ('T020001','0001') and ss.cCusCode not in ('T020001','0001')
         ${ew.customSqlSegment} and  cc.cCusCode in ('T020001','0001') and ss.cCusCode not in ('T020001','0001')
         and c.cInvCcode like '19%'
         and c.cInvCcode like '19%'
-        GROUP BY v.cVenName
+           GROUP BY ss.csocode,o.omCode,s.cInvCode,s.cFree1
 
 
         union all
         union all
 
 
-        SELECT max(o.omCode) as planCode,max(c.PictureGUID) as pictureId,
+        SELECT max(o.omCode) as planCode,max(c.PictureGUID) as pictureId,'903' as account,sum(s.finquantity) as finquantity,
         max(ss.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(s.icostsum) as icostsum,
         max(ss.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(s.icostsum) as icostsum,
         max(v.cVenName) as cDefine12,max(s.cInvCode) as cInvCode,max(s.cInvName) as cInvName,max(s.cdefine22) as itemNumber,
         max(v.cVenName) as cDefine12,max(s.cInvCode) as cInvCode,max(s.cInvName) as cInvName,max(s.cdefine22) as itemNumber,
-        max(s.cFree1) as color,max(s.dPreDate) as dPreDateBT,sum(s.iQuantity) as iQuantity,max(s.iTaxUnitPrice) as iTaxUnitPrice,
+        max(s.cFree1) as color,min(s.dPreDate) as dPreDateBT,sum(s.iQuantity) as iQuantity,max(round(s.iTaxUnitPrice,4)) as iTaxUnitPrice,
         sum(s.iSum) as totalSum,max(s.iNatUnitPrice) as bbPrice,max(s.iNatSum) as iNatSum,sum(s.foutquantity) as foutquantity,sum(s.iKPQuantity) as iKPQuantity
         sum(s.iSum) as totalSum,max(s.iNatUnitPrice) as bbPrice,max(s.iNatSum) as iNatSum,sum(s.foutquantity) as foutquantity,sum(s.iKPQuantity) as iKPQuantity
         FROM  UFDATA_903_2021.dbo.SO_SODetails a
         FROM  UFDATA_903_2021.dbo.SO_SODetails a
         inner JOIN UFDATA_903_2021.dbo.SO_SOMain b on b.ID= a.ID
         inner JOIN UFDATA_903_2021.dbo.SO_SOMain b on b.ID= a.ID
@@ -99,7 +99,7 @@ SELECT  max(o.omCode) as planCode,max(c.PictureGUID) as pictureId,
         inner JOIN UFDATA_901_2021.dbo.Customer cu ON ss.cCusCode = cu.cCusCode
         inner JOIN UFDATA_901_2021.dbo.Customer cu ON ss.cCusCode = cu.cCusCode
           ${ew.customSqlSegment} and cc.cCusCode in ('T020001','0001') and ss.cCusCode not in ('T020001','0001')  and c.cInvCcode like '19%'
           ${ew.customSqlSegment} and cc.cCusCode in ('T020001','0001') and ss.cCusCode not in ('T020001','0001')  and c.cInvCcode like '19%'
 
 
-        GROUP BY v.cVenName ) t
+            GROUP BY ss.csocode,o.omCode,s.cInvCode,s.cFree1) t
 
 
     </select>
     </select>
    <select id="selectByPageXXXXX" resultType="org.jeecg.modules.productionScheduleReport.entity.ProductionSchedule">
    <select id="selectByPageXXXXX" resultType="org.jeecg.modules.productionScheduleReport.entity.ProductionSchedule">

+ 22 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/productionScheduleReport/service/impl/ProductionScheduleImpl.java

@@ -9,6 +9,9 @@ import org.jeecg.modules.productionScheduleReport.entity.ProductionScheduleCaiGo
 import org.jeecg.modules.productionScheduleReport.entity.ProductionScheduleWeiWai;
 import org.jeecg.modules.productionScheduleReport.entity.ProductionScheduleWeiWai;
 import org.jeecg.modules.productionScheduleReport.mapper.ProductionScheduleMapper;
 import org.jeecg.modules.productionScheduleReport.mapper.ProductionScheduleMapper;
 import org.jeecg.modules.productionScheduleReport.service.ProductionScheduleService;
 import org.jeecg.modules.productionScheduleReport.service.ProductionScheduleService;
+import org.jeecg.modules.report.entity.AccessorItem;
+import org.jeecg.modules.report.mapper.FabricLossMapper;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -19,11 +22,29 @@ public class ProductionScheduleImpl extends ServiceImpl<ProductionScheduleMapper
 
 
     @Resource
     @Resource
     private ProductionScheduleMapper productionScheduleMapper;
     private ProductionScheduleMapper productionScheduleMapper;
+    @Autowired
+    private FabricLossMapper fabricLossMapper;
 
 
+    /**
+     * 列表查询
+     * @param page
+     * @param queryWrapper
+     * @return
+     */
     @Override
     @Override
     @DS("multi-one")
     @DS("multi-one")
     public IPage<ProductionSchedule> selectByPage(IPage<ProductionSchedule> page,QueryWrapper<ProductionSchedule> queryWrapper) {
     public IPage<ProductionSchedule> selectByPage(IPage<ProductionSchedule> page,QueryWrapper<ProductionSchedule> queryWrapper) {
-        return productionScheduleMapper.selectByPage(page, queryWrapper);
+        IPage<ProductionSchedule> pageList = productionScheduleMapper.selectByPage(page, queryWrapper);
+
+        for(ProductionSchedule li:pageList.getRecords()){
+            // 销售订单附件
+            List<AccessorItem> accessorItemList = fabricLossMapper.getSoAccList(li.getCSOCode());
+            accessorItemList.forEach(e->e.setFileurl("/report/FabricLoss/getFile?fileId="+e.getCFileId()+"&filename="+e.getFilename()));
+            li.setAccessorItemList(accessorItemList);
+        }
+
+
+        return pageList;
     }
     }