浏览代码

进度报表代码提交

zengtx 2 年之前
父节点
当前提交
40dc3f095c

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.productionScheduleReport.controller;
 
+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.plugins.pagination.Page;
@@ -10,16 +11,22 @@ import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.openApi.service.impl.SenYuDataSourceOneServiceImpl;
+import org.jeecg.modules.openApi.service.impl.SenYuDataSourceThreeServiceImpl;
+import org.jeecg.modules.openApi.service.impl.SenYuDataSourceTwoServiceImpl;
 import org.jeecg.modules.productionScheduleReport.entity.ProductionSchedule;
 import org.jeecg.modules.productionScheduleReport.entity.ProductionScheduleCaiGou;
 import org.jeecg.modules.productionScheduleReport.entity.ProductionScheduleWeiWai;
+import org.jeecg.modules.productionScheduleReport.mapper.ProductionScheduleMapper;
 import org.jeecg.modules.productionScheduleReport.service.ProductionScheduleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import static org.jeecg.common.config.mqtoken.UserTokenContext.getToken;
 
@@ -33,6 +40,12 @@ import static org.jeecg.common.config.mqtoken.UserTokenContext.getToken;
 public class ProductionScheduleController {
     @Autowired
     private ProductionScheduleService productionScheduleService;
+    @Autowired
+    private SenYuDataSourceOneServiceImpl senYuDataSourceOneService;
+    @Autowired
+    private SenYuDataSourceTwoServiceImpl senYuDataSourceTwoService;
+    @Autowired
+    private SenYuDataSourceThreeServiceImpl senYuDataSourceThreeService;
 
     @AutoLog(value = "生产进度报表-分页列表查询")
     @ApiOperation(value="生产进度报表-分页列表查询", notes="生产进度报表-分页列表查询")
@@ -49,48 +62,48 @@ public class ProductionScheduleController {
         QueryWrapper<ProductionSchedule> queryWrapper = new QueryWrapper<>();
 
             if(StringUtils.isNotBlank(productionSchedule.getCSOCode())){//销售订单号
-                queryWrapper.eq("ss.csocode",productionSchedule.getCSOCode());
+                queryWrapper.eq("sd.csocode",productionSchedule.getCSOCode());
             }
             if(StringUtils.isNotBlank(productionSchedule.getCDepName())){//部门
-                queryWrapper.eq("c.cDepName",productionSchedule.getCDepName());
+                queryWrapper.eq("de.cDepName",productionSchedule.getCDepName());
             }
             if(StringUtils.isNotBlank(productionSchedule.getCInvName())){//物料名称
-                queryWrapper.eq("f.cInvName",productionSchedule.getCInvName());
+                queryWrapper.eq("sd.cInvName",productionSchedule.getCInvName());
             }
             if(StringUtils.isNotBlank(productionSchedule.getCDefine12())){//成衣加工厂
-                queryWrapper.eq("v.cVenName",productionSchedule.getCDefine12());
+                queryWrapper.eq("s.cDefine12",productionSchedule.getCDefine12());
             }
             if(StringUtils.isNotBlank(productionSchedule.getCPersonName())){//业务员
-                queryWrapper.eq("d.cPersonName",productionSchedule.getCPersonName());
+                queryWrapper.eq("pe.cPersonName",productionSchedule.getCPersonName());
             }
             if(StringUtils.isNotBlank(productionSchedule.getPlanCode())){//计划单号
-                queryWrapper.eq("o.omCode",productionSchedule.getPlanCode());
+                queryWrapper.eq("od3.cPlanLotNumber",productionSchedule.getPlanCode());
             }
             if(StringUtils.isNotBlank(dDateB)){//订单日期
-                queryWrapper.between("ss.dDate",dDateB,dDateE);
+                queryWrapper.between("s.dDate",dDateB,dDateE);
             }
             if(StringUtils.isNotBlank(productionSchedule.getItemNumber())){//款号 item_number
-                queryWrapper.eq("s.cdefine22",productionSchedule.getItemNumber());
+                queryWrapper.eq("sd.cdefine22",productionSchedule.getItemNumber());
             }
             if(StringUtils.isNotBlank(dPreDateB)){//交期
-                queryWrapper.between("s.dPreDate",dPreDateB,dPreDateE);
+                queryWrapper.between("sd.dPreDate",dPreDateB,dPreDateE);
              }
 
         IPage<ProductionSchedule> pageList = productionScheduleService.selectByPage(page,queryWrapper);
 
         //获取计划号
-        for(ProductionSchedule li:pageList.getRecords()){
-            //截取计划号
-            int indexof = li.getPlanCode().indexOf("SY");
-            if(indexof !=-1) {
-                int g = li.getPlanCode().indexOf("-", indexof);
-                if (g < 0) {
-                    li.setPlanCode(li.getPlanCode().substring(indexof));
-                } else {
-                    li.setPlanCode(li.getPlanCode().substring(indexof, g));
-                }
-            }
-        }
+//        for(ProductionSchedule li:pageList.getRecords()){
+//            //截取计划号
+//            int indexof = li.getPlanCode().indexOf("SY");
+//            if(indexof !=-1) {
+//                int g = li.getPlanCode().indexOf("-", indexof);
+//                if (g < 0) {
+//                    li.setPlanCode(li.getPlanCode().substring(indexof));
+//                } else {
+//                    li.setPlanCode(li.getPlanCode().substring(indexof, g));
+//                }
+//            }
+//        }
 
         result.setSuccess(true);
         result.setResult(pageList);
@@ -106,28 +119,27 @@ public class ProductionScheduleController {
     @AutoLog(value = "生产进度报表-查看详情")
     @ApiOperation(value="生产进度报表-查看详情", notes="生产进度报表-查看详情")
     @GetMapping(value = "/getView")
-    public Result<ProductionSchedule> getView(String soCode){
+    public Result<ProductionSchedule> getView(String soCode,String planCode,String cInvCode,String color){
         Result<ProductionSchedule> result = new Result<ProductionSchedule>();
 
+        List<Map<String,Object>> listMap= new ArrayList<>();
         Page<ProductionSchedule> page = new Page<ProductionSchedule>(1, 2);
 
+        ProductionSchedule entity = new ProductionSchedule();
+
+
+        //查询详情
         QueryWrapper<ProductionSchedule> queryWrapper = new QueryWrapper<>();
-        //queryWrapper.eq("")
+        queryWrapper.eq("sd.csocode",soCode);//订单号
+        queryWrapper.eq("sd.cInvCode",cInvCode);//物料
+        queryWrapper.eq("sd.cfree1",color);//颜色
+        queryWrapper.eq("od3.cPlanLotNumber",planCode);//物料W
+        //ss.csocode,o.omCode,s.cInvCode,s.cFree1
         IPage<ProductionSchedule> pageList = productionScheduleService.selectByPage(page,queryWrapper);
-//        List<ProductionSchedule> list = productionScheduleService.selectByView(queryWrapper); // 详情数据
-//        if(list.size() > 0){
-//            entity = list.get(0);
-//        }
-
-        //根据计划号 查询采购订单
-//        List<ProductionScheduleCaiGou> selectCaiGou = productionScheduleService.selectCaiGou(planCode);
-//        entity.setProductionScheduleCaiGou(selectCaiGou);
-        //根据计划号查询委外订单
-//        List<ProductionScheduleWeiWai> selectWeiWai = productionScheduleService.selectWeiWai(planCode);
-//        entity.setProductionScheduleWeiWai(selectWeiWai);
+        entity = pageList.getRecords().get(0);
 
-       // result.setResult(entity);
 
+        result.setResult(entity);
         result.setSuccess(true);
         return result;
     }

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

@@ -15,51 +15,55 @@ public class ProductionSchedule {
     //订单子表ID
     private String iSOsID;
     @ApiModelProperty(value = "部门")
-    private String cDepName;// ;// 部门
+    private String cDepName;
     @ApiModelProperty(value = "业务员")
-    private String cPersonName;// ;// 业务员
+    private String cPersonName;
     @ApiModelProperty(value = "销售订单号")
-    private String cSOCode;// ;// 销售订单号
+    private String cSOCode;
     @ApiModelProperty(value = "计划单号")
-    private String planCode;// ;// 计划单号
+    private String planCode;
     @ApiModelProperty(value = "客户")
-    private String cCusName ;// 客户
+    private String cCusName;
     @ApiModelProperty(value = "成衣加工厂")
-    private String cDefine12 ;// 成衣加工厂
+    private String cDefine12;
     @ApiModelProperty(value = "存货编码")
-    private String cInvCode ;// 存货编码
+    private String cInvCode;
     @ApiModelProperty(value = "存货名称")
-    private String cInvName ;// 存货名称
+    private String cInvName;
     @ApiModelProperty(value = "款号")
-    private String itemNumber ;// 款号
+    private String itemNumber;
     @ApiModelProperty(value = "颜色")
-    private String color;// 颜色
+    private String color;
     @ApiModelProperty(value = "交期")
-    private String dPreDateBT ;// 交期
+    private String dPreDateBT;
     @ApiModelProperty(value = "订单日期")
-    private String dDate ;// 订单日期
+    private String dDate;
     @ApiModelProperty(value = "订单数量")
-    private Double iQuantity ;//订单数量
-    @ApiModelProperty(value = "原币含税单价")
-    private Double iTaxUnitPrice ;// 原币含税单价
+    private Double iQuantity;
+    @ApiModelProperty(value = "销售单价(原币)")
+    private String iTaxUnitPrice;
+    @ApiModelProperty(value = "销售单价(原币)")
+    private String iTaxUnitPriceD;
     @ApiModelProperty(value = "总额(原币)")
-    private Double totalSum ;// 总额(原币)
-    @ApiModelProperty(value = "单价(本币)")
-    private Double bbPrice ;// 单价(本币)
+    private String totalSum;
+    @ApiModelProperty(value = "单价(采购)")
+    private String poPrice;
+    @ApiModelProperty(value = "单价(委外)")
+    private String moPrice;
     @ApiModelProperty(value = "总额(本币)")
-    private Double iNatSum ;// 总额(本币)
+    private String iNatSum;
     @ApiModelProperty(value = "实际发票成本")
-    private Double icostsum ;// 实际发票成本
+    private Double icostsum;
     @ApiModelProperty(value = "已出库数量")
-    private Double foutquantity ;//已出库数量
+    private Double foutquantity;
     @ApiModelProperty(value = "累计开票数量")
-    private Double iKPQuantity ;//累计开票数量
+    private Double iKPQuantity;
     @ApiModelProperty(value = "累计开票金额")
-    private Double iKPMoney ;// 累计开票金额
+    private Double iKPMoney;
     @ApiModelProperty(value = "图片id")
-    private String pictureId;//图片id
+    private String pictureId;
     @ApiModelProperty(value = "图片流")
-    private byte[] picture;//图片流
+    private byte[] picture;
     @ApiModelProperty(value = "生产进度报表(委外订单数据)")
     private List<ProductionScheduleWeiWai> productionScheduleWeiWai;
     @ApiModelProperty(value = "生产进度报表(采购订单数据)")
@@ -69,13 +73,17 @@ public class ProductionSchedule {
 
     // 销售订单附件
     List<AccessorItem> accessorItemList;
+    //账套
+    private String account;
+    //币种
+    private String cexchName;
 
 
     //查询条件
     private String stateTime;
     private String endTime;
 
-    //账套
-    private String account;
+
+
 
 }

+ 33 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/productionScheduleReport/entity/ProductionScheduleCaiGou.java

@@ -8,22 +8,40 @@ import lombok.Data;
  */
 @Data
 public class ProductionScheduleCaiGou {
-    @ApiModelProperty(value = "采购订单号")
-    private String cPOID;// 采购订单号
-    @ApiModelProperty(value = "供应商名称")
-    private String cVenName;// ;// 供应商名称
-    @ApiModelProperty(value = "存货编码")
-    private String cInvCode ;// 存货编码
-    @ApiModelProperty(value = "存货名称")
+
+    //账套号
+    private String account;
+    //采购订单号
+    private String poOrom;// 采购订单号
+    //存货名称
     private String cInvName ;// 存货名称
-    @ApiModelProperty(value = "本币单价")
-    private String iNatUnitPrice ;// 本币单价
-    @ApiModelProperty(value = "计划数量(lrp)")
+    //颜色
+    private String color;
+    //计划数量(lrp)
     private String iQuantityLrp;// 计划数量(lrp)
-    @ApiModelProperty(value = "数量")
+
+    //订单数量
     private String iQuantity ;//数量
-    @ApiModelProperty(value = "使用数量")
-    private String iReceivedQTY ;// 使用数量
-    @ApiModelProperty(value = "余料")
-    private String surplusQty ;// 余料
+
+    //入库数量(订单里累计入库数量)
+    private Double finquantity;
+
+
+    //使用数量(订单下的材料出库单数量)
+    private String iReceivedQTY ;
+
+    //单价(拼接订单币种)
+    private String iNatUnitPrice ;
+
+    //余料(入库数量-使用数量)
+    private String clout;
+
+    //下游订单号(材料出库单被哪个订单使用了,可能有多个 逗号隔开)
+    private String downCode;
+
+    //供应商(取简称)、
+    private String cVenName;
+    //订单类型(采购、委外)
+    private String poOromType;
+
 }

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

@@ -9,6 +9,7 @@ import org.jeecg.modules.productionScheduleReport.entity.ProductionScheduleCaiGo
 import org.jeecg.modules.productionScheduleReport.entity.ProductionScheduleWeiWai;
 
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -18,9 +19,11 @@ import java.util.List;
  */
 public interface ProductionScheduleMapper extends BaseMapper<ProductionSchedule> {
 
+    //分页列表查询
     public IPage<ProductionSchedule> selectByPage(@Param("page") IPage<ProductionSchedule> page,@Param("ew") QueryWrapper<ProductionSchedule> queryWrapper);
 
-    List<ProductionSchedule> selectByPage(@Param("ew") QueryWrapper<ProductionSchedule> queryWrapper);
+    //查询本账套采购订单(穿订单号)
+    public List<Map<String,Object>> queryPOPomain(@Param("csCode") String csCode);
 
     List<ProductionSchedule> selectPicture(String pictureId);
 

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

@@ -5,101 +5,84 @@
     <select id="selectByPage" resultType="org.jeecg.modules.productionScheduleReport.entity.ProductionSchedule">
 
 select t.* from (
-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(v.cVenName) as cDefine12,max(s.cInvCode) as cInvCode,max(s.cInvName) as cInvName,max(s.cdefine22) as itemNumber,
-        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
-           FROM  UFDATA_901_2021.dbo.SO_SODetails s
-        inner JOIN UFDATA_901_2021.dbo.SO_SOMain ss on ss.ID= s.ID
-        inner JOIN (
-                     SELECT
-                     om.cCode AS omCode,
-                     om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
-                     om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
-                     FROM
-                     UFDATA_901_2021.dbo.OM_MOMain om
-                     inner JOIN UFDATA_901_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
-                     WHERE
-                     om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')
-
-                     ) o ON s.isosid  = o.isosid AND s.cInvCode = o.cInvCode
-        inner JOIN UFDATA_901_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
-        inner JOIN UFDATA_901_2021.dbo.Inventory c on c.cInvCode=s.cInvCode
-        inner JOIN UFDATA_901_2021.dbo.Person  pe ON ss.cPersonCode = pe.cPersonCode
-        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
-        ${ew.customSqlSegment} and c.cInvCcode like '19%'
-         GROUP BY ss.csocode,o.omCode,s.cInvCode,s.cFree1
-        union all
-
-        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(v.cVenName) as cDefine12,max(s.cInvCode) as cInvCode,max(s.cInvName) as cInvName,max(s.cdefine22) as itemNumber,
-        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
-        FROM  UFDATA_903_2021.dbo.SO_SODetails a
-        inner JOIN UFDATA_903_2021.dbo.SO_SOMain b on b.ID= a.ID
-        inner JOIN (
-                     SELECT
-                     om.cCode AS omCode, od.csoordercode,
-                     om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
-                     om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
-                     FROM
-                     UFDATA_903_2021.dbo.OM_MOMain om
-                     inner JOIN UFDATA_903_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
-                     WHERE
-                     om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')
-                     ) o ON a.isosid  = o.isosid AND a.cInvCode = o.cInvCode
-        inner JOIN UFDATA_903_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
-        inner JOIN UFDATA_903_2021.dbo.Inventory c on c.cInvCode=a.cInvCode
-        inner JOIN UFDATA_903_2021.dbo.Person  pe ON b.cPersonCode = pe.cPersonCode
-        inner JOIN UFDATA_903_2021.dbo.Department de ON b.cDepCode = de.cDepCode
-        inner JOIN UFDATA_903_2021.dbo.Customer cc ON b.cCusCode = cc.cCusCode
-        inner join UFDATA_902_2021.dbo.PO_Pomain f on f.cPOID=o.csoordercode
-        inner join UFDATA_902_2021.dbo.po_podetails g on g.POID=f.POID
-        inner join UFDATA_902_2021.dbo.SO_SODetails s on s.iSOsID=g.iorderdid
-        inner join UFDATA_902_2021.dbo.so_somain ss on ss.id=s.id
-        inner join UFDATA_902_2021.dbo.Person j on j.cPersonCode=ss.cPersonCode
-        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')
-        and c.cInvCcode like '19%'
-           GROUP BY ss.csocode,o.omCode,s.cInvCode,s.cFree1
-
-        union all
-
-        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(v.cVenName) as cDefine12,max(s.cInvCode) as cInvCode,max(s.cInvName) as cInvName,max(s.cdefine22) as itemNumber,
-        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
-        FROM  UFDATA_903_2021.dbo.SO_SODetails a
-        inner JOIN UFDATA_903_2021.dbo.SO_SOMain b on b.ID= a.ID
-        inner JOIN (
-                     SELECT
-                     om.cCode AS omCode, od.csoordercode,
-                     om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
-                     om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
-                     FROM
-                     UFDATA_903_2021.dbo.OM_MOMain om
-                     inner JOIN UFDATA_903_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
-                     WHERE
-                     om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')
-                     ) o ON a.isosid  = o.isosid AND a.cInvCode = o.cInvCode
-        inner JOIN UFDATA_903_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
-        inner JOIN UFDATA_903_2021.dbo.Inventory c on c.cInvCode=a.cInvCode
-        inner JOIN UFDATA_903_2021.dbo.Person  pe ON b.cPersonCode = pe.cPersonCode
-        inner JOIN UFDATA_903_2021.dbo.Department de ON b.cDepCode = de.cDepCode
-        inner JOIN UFDATA_903_2021.dbo.Customer cc ON b.cCusCode = cc.cCusCode
-        inner join UFDATA_901_2021.dbo.PO_Pomain f on f.cPOID=o.csoordercode
-        inner join UFDATA_901_2021.dbo.po_podetails g on g.POID=f.POID
-        inner join UFDATA_901_2021.dbo.SO_SODetails s on s.iSOsID=g.iorderdid
-        inner join UFDATA_901_2021.dbo.so_somain ss on ss.id=s.id
-        inner join UFDATA_901_2021.dbo.Person j on j.cPersonCode=ss.cPersonCode
-        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%'
-
-            GROUP BY ss.csocode,o.omCode,s.cInvCode,s.cFree1) t
+
+select max(cus.cCusName) as cCusName,max(od3.cPlanLotNumber) as planCode,max(inv.PictureGUID) as pictureId,'901' as account,sum(sd.finquantity) as finquantity,
+        max(sd.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(sd.icostsum) as icostsum,
+        max(s.cDefine12) as cDefine12,max(sd.cInvCode) as cInvCode,max(sd.cInvName) as cInvName,max(sd.cdefine22) as itemNumber,
+        max(sd.cFree1) as color,min(sd.dPreDate) as dPreDateBT,sum(sd.iQuantity) as iQuantity,concat(max(round(sd.iTaxUnitPrice,4)),'-',max(s.cexch_name)) as iTaxUnitPriceD,max(round(sd.iTaxUnitPrice,4)) as iTaxUnitPrice,
+         concat(sum(sd.iSum),'-',max(s.cexch_name)) as totalSum,concat(max(od3.iTaxPrice),'-',max(om3.cexch_name)) as moPrice,concat(max(sd.iNatSum),'-',max(s.cexch_name)) as iNatSum,sum(sd.foutquantity) as foutquantity,sum(sd.iKPQuantity) as iKPQuantity from UFDATA_901_2021.dbo.SO_SODetails sd
+JOIN UFDATA_901_2021.dbo.SO_SOMain s on s.ID= sd.ID
+JOIN UFDATA_901_2021.dbo.PO_Podetails pd on sd.iSOsID=pd.iSOsID
+JOIN UFDATA_901_2021.dbo.PO_Pomain pm on pd.poid=pm.poid
+JOIN UFDATA_901_2021.dbo.Inventory inv on inv.cInvCode = sd.cInvCode
+JOIN UFDATA_901_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
+JOIN UFDATA_901_2021.dbo.Department de ON s.cDepCode = de.cDepCode
+JOIN UFDATA_901_2021.dbo.Customer cus ON cus.cCusCode = s.cCusCode
+JOIN UFDATA_902_2021.dbo.SO_SODetails sd2 on sd2.iRowNo=pd.ivouchrowno and sd2.cSOCode=pm.cpoid
+JOIN UFDATA_902_2021.dbo.PO_Podetails pd2 on sd2.iSOsID=pd2.iorderdid
+JOIN UFDATA_902_2021.dbo.PO_Pomain pm2 on pd2.POID = pm2.POID
+JOIN UFDATA_903_2021.dbo.SO_SODetails sd3 on sd3.iRowNo=pd2.ivouchrowno and sd3.cSOCode=pm2.cpoid
+JOIN UFDATA_903_2021.dbo.OM_MODetails od3 on od3.isosid=sd3.iSOsID
+JOIN UFDATA_903_2021.dbo.OM_MOMain om3 on om3.moid=od3.MOID
+${ew.customSqlSegment}
+group by s.csocode,od3.cPlanLotNumber,sd.cInvCode,sd.cFree1
+
+UNION ALL
+
+select max(cus.cCusName) as cCusName,max(od3.cPlanLotNumber) as planCode,max(inv.PictureGUID) as pictureId,'901' as account,sum(sd.finquantity) as finquantity,
+        max(sd.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(sd.icostsum) as icostsum,
+        max(s.cDefine12) as cDefine12,max(sd.cInvCode) as cInvCode,max(sd.cInvName) as cInvName,max(sd.cdefine22) as itemNumber,
+        max(sd.cFree1) as color,min(sd.dPreDate) as dPreDateBT,sum(sd.iQuantity) as iQuantity,concat(max(round(sd.iTaxUnitPrice,4)),'-',max(s.cexch_name)) as iTaxUnitPriceD,max(round(sd.iTaxUnitPrice,4)) as iTaxUnitPrice,
+         concat(sum(sd.iSum),'-',max(s.cexch_name)) as totalSum,concat(max(od3.iTaxPrice),'-',max(om3.cexch_name)) as moPrice,concat(max(sd.iNatSum),'-',max(s.cexch_name)) as iNatSum,sum(sd.foutquantity) as foutquantity,sum(sd.iKPQuantity) as iKPQuantity from UFDATA_901_2021.dbo.SO_SODetails sd
+JOIN UFDATA_901_2021.dbo.SO_SOMain s on s.ID= sd.ID
+JOIN UFDATA_901_2021.dbo.PO_Podetails pd on sd.iSOsID=pd.iSOsID
+JOIN UFDATA_901_2021.dbo.PO_Pomain pm on pd.poid=pm.poid
+JOIN UFDATA_901_2021.dbo.Inventory inv on inv.cInvCode = sd.cInvCode
+JOIN UFDATA_901_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
+JOIN UFDATA_901_2021.dbo.Department de ON s.cDepCode = de.cDepCode
+JOIN UFDATA_901_2021.dbo.Customer cus ON cus.cCusCode = s.cCusCode
+JOIN UFDATA_903_2021.dbo.SO_SODetails sd3 on sd3.iRowNo=pd.ivouchrowno and sd3.cSOCode=pm.cpoid
+JOIN UFDATA_903_2021.dbo.SO_SOMain s3 on sd3.ID = s3.ID
+JOIN UFDATA_903_2021.dbo.OM_MODetails od3 on od3.isosid=sd3.iSOsID
+JOIN UFDATA_903_2021.dbo.OM_MOMain om3 on om3.moid=od3.MOID
+JOIN UFDATA_903_2021.dbo.Vendor v on v.cVenCode=om3.cVenCode
+${ew.customSqlSegment} and inv.cInvCcode like '19%' and s3.cCuscode != '0001'
+group by s.csocode,od3.cPlanLotNumber,sd.cInvCode,sd.cFree1
+
+UNION ALL
+
+select max(cus.cCusName) as cCusName,max(od3.cPlanLotNumber) as planCode,max(inv.PictureGUID) as pictureId,'901' as account,sum(sd.finquantity) as finquantity,
+        max(sd.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(sd.icostsum) as icostsum,
+        max(s.cDefine12) as cDefine12,max(sd.cInvCode) as cInvCode,max(sd.cInvName) as cInvName,max(sd.cdefine22) as itemNumber,
+        max(sd.cFree1) as color,min(sd.dPreDate) as dPreDateBT,sum(sd.iQuantity) as iQuantity,concat(max(round(sd.iTaxUnitPrice,4)),'-',max(s.cexch_name)) as iTaxUnitPriceD,max(round(sd.iTaxUnitPrice,4)) as iTaxUnitPrice,
+         concat(sum(sd.iSum),'-',max(s.cexch_name)) as totalSum,concat(max(od3.iTaxPrice),'-',max(om3.cexch_name)) as moPrice,concat(max(sd.iNatSum),'-',max(s.cexch_name)) as iNatSum,sum(sd.foutquantity) as foutquantity,sum(sd.iKPQuantity) as iKPQuantity from UFDATA_901_2021.dbo.SO_SODetails sd
+JOIN UFDATA_901_2021.dbo.SO_SOMain s on s.ID= sd.ID
+JOIN UFDATA_901_2021.dbo.om_modetails od3  on sd.isosid = od3.isosid
+JOIN UFDATA_901_2021.dbo.OM_MOMain om3 on om3.moid=od3.MOID
+JOIN UFDATA_901_2021.dbo.Inventory inv on sd.cInvCode = inv.cInvCode
+JOIN UFDATA_901_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
+JOIN UFDATA_901_2021.dbo.Department de ON s.cDepCode = de.cDepCode
+JOIN UFDATA_901_2021.dbo.Customer cus ON cus.cCusCode = s.cCusCode
+${ew.customSqlSegment} and inv.cInvCcode like '19%'
+group by s.csocode,od3.cPlanLotNumber,sd.cInvCode,sd.cFree1
+
+UNION ALL
+
+select  max(cus.cCusName) as cCusName,max(od3.cPlanLotNumber) as planCode,max(inv.PictureGUID) as pictureId,'903' as account,sum(sd.finquantity) as finquantity,
+        max(sd.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(sd.icostsum) as icostsum,
+        max(s.cDefine12) as cDefine12,max(sd.cInvCode) as cInvCode,max(sd.cInvName) as cInvName,max(sd.cdefine22) as itemNumber,
+        max(sd.cFree1) as color,min(sd.dPreDate) as dPreDateBT,sum(sd.iQuantity) as iQuantity,concat(max(round(sd.iTaxUnitPrice,4)),'-',max(s.cexch_name)) as iTaxUnitPriceD,max(round(sd.iTaxUnitPrice,4)) as iTaxUnitPrice,
+         concat(sum(sd.iSum),'-',max(s.cexch_name)) as totalSum,concat(max(od3.iTaxPrice),'-',max(om3.cexch_name)) as moPrice,concat(max(sd.iNatSum),'-',max(s.cexch_name)) as iNatSum,sum(sd.foutquantity) as foutquantity,sum(sd.iKPQuantity) as iKPQuantity from UFDATA_901_2021.dbo.SO_SODetails sd
+JOIN UFDATA_901_2021.dbo.SO_SOMain s on s.ID= sd.ID
+join om_modetails od3 on sd.isosid = od3.isosid
+join UFDATA_903_2021.dbo.OM_MOMain om3 on om3.moid=od3.MOID
+join UFDATA_903_2021.dbo.Inventory inv on sd.cInvCode = inv.cInvCode
+JOIN UFDATA_903_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
+JOIN UFDATA_903_2021.dbo.Department de ON s.cDepCode = de.cDepCode
+JOIN UFDATA_903_2021.dbo.Customer cus ON cus.cCusCode = s.cCusCode
+${ew.customSqlSegment} and inv.cInvCcode like '19%' and s.cCuscode != '0001' and  s.cCuscode != 'T020001'
+group by s.csocode,od3.cPlanLotNumber,sd.cInvCode,sd.cFree1
+         ) t
 
     </select>
    <select id="selectByPageXXXXX" resultType="org.jeecg.modules.productionScheduleReport.entity.ProductionSchedule">
@@ -136,37 +119,125 @@ SELECT  max(o.omCode) as planCode,max(c.PictureGUID) as pictureId,'901' as accou
 
 
     <select id="selectWeiWai" resultType="org.jeecg.modules.productionScheduleReport.entity.ProductionScheduleWeiWai">
-        select
-               '903' accId -- 账套信息
-             ,a.cCode -- 委外订单号
-			 ,c.cVenName -- 供应商名称
-             ,b.cInvCode -- 物料编码
-             ,d.cInvName -- 存货名称
-             ,b.cFree1 color -- 颜色
-             ,b.cFree4 -- 门幅
-             ,b.iUnitPrice -- 原币单价
-             ,b.iNatUnitPrice -- 本币单价
-             ,b.iQuantity iQuantityLrp -- 计划数量
-             ,b.iQuantity -- 数量
-             ,b.iReceivedQTY -- 累计入库数量
-             ,b.iInvQTY -- 累计开票数量
-             ,b.iInvMoney -- 累计开票金额
-             ,b.csocode -- 下游订单
-             ,b.iMaterialSendQty   -- 使用数量
-             ,b.iQuantity - b.iMaterialSendQty as surplusQty -- 余料
-             ,e.cInvCode cInvCodeZi --子件编码
-             ,f.cInvName cInvNameZi -- 子件名称
-             ,e.iQuantity iQuantityZi -- 子件应领数量
-             ,e.iSendQTY -- 子件已领数量
-             ,0 costZi -- 成本
-             ,0 purchaseCode -- 采购订单号
-        from OM_MOMain a
-                 left join OM_MODetails b on a.MOID = b.MOID
-                 left join Vendor c on a.cVenCode = c.cVenCode
-                 left join Inventory d on d.cInvCode = b.cInvCode
-                 left join OM_MOMaterials e on e.MoDetailsID = b.MoDetailsID
-                 left join Inventory f on f.cInvCode = e.cInvCode
-        where b.cPlanLotNumber = #{planNumber}
+
+select t.* from (
+
+select '903' as account, om3.cCode as poOrom,
+from UFDATA_901_2021.dbo.SO_SODetails sd
+JOIN UFDATA_901_2021.dbo.SO_SOMain s on s.ID= sd.ID
+JOIN UFDATA_901_2021.dbo.PO_Podetails pd on sd.iSOsID=pd.iSOsID
+JOIN UFDATA_901_2021.dbo.PO_Pomain pm on pd.poid=pm.poid
+JOIN UFDATA_901_2021.dbo.Inventory inv on inv.cInvCode = sd.cInvCode
+JOIN UFDATA_901_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
+JOIN UFDATA_901_2021.dbo.Department de ON s.cDepCode = de.cDepCode
+JOIN UFDATA_901_2021.dbo.Customer cus ON cus.cCusCode = s.cCusCode
+JOIN UFDATA_902_2021.dbo.SO_SODetails sd2 on sd2.iRowNo=pd.ivouchrowno and sd2.cSOCode=pm.cpoid
+JOIN UFDATA_902_2021.dbo.PO_Podetails pd2 on sd2.iSOsID=pd2.iorderdid
+JOIN UFDATA_902_2021.dbo.PO_Pomain pm2 on pd2.POID = pm2.POID
+JOIN UFDATA_903_2021.dbo.SO_SODetails sd3 on sd3.iRowNo=pd2.ivouchrowno and sd3.cSOCode=pm2.cpoid
+JOIN UFDATA_903_2021.dbo.OM_MODetails od3 on od3.isosid=sd3.iSOsID
+JOIN UFDATA_903_2021.dbo.OM_MOMain om3 on om3.moid=od3.MOID
+${ew.customSqlSegment}
+group by s.csocode,od3.cPlanLotNumber,sd.cInvCode,sd.cFree1
+
+UNION ALL
+
+select max(cus.cCusName) as cCusName,max(od3.cPlanLotNumber) as planCode,max(inv.PictureGUID) as pictureId,'901' as account,sum(sd.finquantity) as finquantity,
+        max(sd.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(sd.icostsum) as icostsum,
+        max(s.cDefine12) as cDefine12,max(sd.cInvCode) as cInvCode,max(sd.cInvName) as cInvName,max(sd.cdefine22) as itemNumber,
+        max(sd.cFree1) as color,min(sd.dPreDate) as dPreDateBT,sum(sd.iQuantity) as iQuantity,concat(max(round(sd.iTaxUnitPrice,4)),'-',max(s.cexch_name)) as iTaxUnitPriceD,max(round(sd.iTaxUnitPrice,4)) as iTaxUnitPrice,
+         concat(sum(sd.iSum),'-',max(s.cexch_name)) as totalSum,concat(max(od3.iTaxPrice),'-',max(om3.cexch_name)) as moPrice,concat(max(sd.iNatSum),'-',max(s.cexch_name)) as iNatSum,sum(sd.foutquantity) as foutquantity,sum(sd.iKPQuantity) as iKPQuantity from UFDATA_901_2021.dbo.SO_SODetails sd
+JOIN UFDATA_901_2021.dbo.SO_SOMain s on s.ID= sd.ID
+JOIN UFDATA_901_2021.dbo.PO_Podetails pd on sd.iSOsID=pd.iSOsID
+JOIN UFDATA_901_2021.dbo.PO_Pomain pm on pd.poid=pm.poid
+JOIN UFDATA_901_2021.dbo.Inventory inv on inv.cInvCode = sd.cInvCode
+JOIN UFDATA_901_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
+JOIN UFDATA_901_2021.dbo.Department de ON s.cDepCode = de.cDepCode
+JOIN UFDATA_901_2021.dbo.Customer cus ON cus.cCusCode = s.cCusCode
+JOIN UFDATA_903_2021.dbo.SO_SODetails sd3 on sd3.iRowNo=pd.ivouchrowno and sd3.cSOCode=pm.cpoid
+JOIN UFDATA_903_2021.dbo.SO_SOMain s3 on sd3.ID = s3.ID
+JOIN UFDATA_903_2021.dbo.OM_MODetails od3 on od3.isosid=sd3.iSOsID
+JOIN UFDATA_903_2021.dbo.OM_MOMain om3 on om3.moid=od3.MOID
+JOIN UFDATA_903_2021.dbo.Vendor v on v.cVenCode=om3.cVenCode
+${ew.customSqlSegment} and inv.cInvCcode like '19%' and s3.cCuscode != '0001'
+group by s.csocode,od3.cPlanLotNumber,sd.cInvCode,sd.cFree1
+
+UNION ALL
+
+select max(cus.cCusName) as cCusName,max(od3.cPlanLotNumber) as planCode,max(inv.PictureGUID) as pictureId,'901' as account,sum(sd.finquantity) as finquantity,
+        max(sd.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(sd.icostsum) as icostsum,
+        max(s.cDefine12) as cDefine12,max(sd.cInvCode) as cInvCode,max(sd.cInvName) as cInvName,max(sd.cdefine22) as itemNumber,
+        max(sd.cFree1) as color,min(sd.dPreDate) as dPreDateBT,sum(sd.iQuantity) as iQuantity,concat(max(round(sd.iTaxUnitPrice,4)),'-',max(s.cexch_name)) as iTaxUnitPriceD,max(round(sd.iTaxUnitPrice,4)) as iTaxUnitPrice,
+         concat(sum(sd.iSum),'-',max(s.cexch_name)) as totalSum,concat(max(od3.iTaxPrice),'-',max(om3.cexch_name)) as moPrice,concat(max(sd.iNatSum),'-',max(s.cexch_name)) as iNatSum,sum(sd.foutquantity) as foutquantity,sum(sd.iKPQuantity) as iKPQuantity from UFDATA_901_2021.dbo.SO_SODetails sd
+JOIN UFDATA_901_2021.dbo.SO_SOMain s on s.ID= sd.ID
+JOIN UFDATA_901_2021.dbo.om_modetails od3  on sd.isosid = od3.isosid
+JOIN UFDATA_901_2021.dbo.OM_MOMain om3 on om3.moid=od3.MOID
+JOIN UFDATA_901_2021.dbo.Inventory inv on sd.cInvCode = inv.cInvCode
+JOIN UFDATA_901_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
+JOIN UFDATA_901_2021.dbo.Department de ON s.cDepCode = de.cDepCode
+JOIN UFDATA_901_2021.dbo.Customer cus ON cus.cCusCode = s.cCusCode
+${ew.customSqlSegment} and inv.cInvCcode like '19%'
+group by s.csocode,od3.cPlanLotNumber,sd.cInvCode,sd.cFree1
+
+UNION ALL
+
+select  max(cus.cCusName) as cCusName,max(od3.cPlanLotNumber) as planCode,max(inv.PictureGUID) as pictureId,'903' as account,sum(sd.finquantity) as finquantity,
+        max(sd.csocode) as cSOCode,max(de.cDepName) as cDepName,max(pe.cPersonName) as cPersonName,max(sd.icostsum) as icostsum,
+        max(s.cDefine12) as cDefine12,max(sd.cInvCode) as cInvCode,max(sd.cInvName) as cInvName,max(sd.cdefine22) as itemNumber,
+        max(sd.cFree1) as color,min(sd.dPreDate) as dPreDateBT,sum(sd.iQuantity) as iQuantity,concat(max(round(sd.iTaxUnitPrice,4)),'-',max(s.cexch_name)) as iTaxUnitPriceD,max(round(sd.iTaxUnitPrice,4)) as iTaxUnitPrice,
+         concat(sum(sd.iSum),'-',max(s.cexch_name)) as totalSum,concat(max(od3.iTaxPrice),'-',max(om3.cexch_name)) as moPrice,concat(max(sd.iNatSum),'-',max(s.cexch_name)) as iNatSum,sum(sd.foutquantity) as foutquantity,sum(sd.iKPQuantity) as iKPQuantity from UFDATA_901_2021.dbo.SO_SODetails sd
+JOIN UFDATA_901_2021.dbo.SO_SOMain s on s.ID= sd.ID
+join om_modetails od3 on sd.isosid = od3.isosid
+join UFDATA_903_2021.dbo.OM_MOMain om3 on om3.moid=od3.MOID
+join UFDATA_903_2021.dbo.Inventory inv on sd.cInvCode = inv.cInvCode
+JOIN UFDATA_903_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
+JOIN UFDATA_903_2021.dbo.Department de ON s.cDepCode = de.cDepCode
+JOIN UFDATA_903_2021.dbo.Customer cus ON cus.cCusCode = s.cCusCode
+${ew.customSqlSegment} and inv.cInvCcode like '19%' and s.cCuscode != '0001' and  s.cCuscode != 'T020001'
+group by s.csocode,od3.cPlanLotNumber,sd.cInvCode,sd.cFree1
+         ) t
+    </select>
+
+
+    <select id="queryPOPomain" parameterType="java.lang.String" resultType="java.util.HashMap">
+
+
+
+
+select '901' as account,po1.cPOID  from UFDATA_901_2021.dbo.PO_Pomain po1
+left join UFDATA_901_2021.dbo.PO_Podetails pod1
+on po1.POID = pod1.POID
+left join UFDATA_901_2021.dbo.SO_SODetails sod1
+on pod1.iorderdid = sod1.iSOsID
+left join UFDATA_901_2021.dbo.SO_SOMain so1
+on sod1.ID = so1.ID
+where po1.cVenCode not in ('T020001','T010001') and so1.csocode = 'FY2023-3200262328-PH2'
+
+union all
+
+select '902' as account, po2.cPOID  from UFDATA_902_2021.dbo.PO_Pomain po2
+left join UFDATA_902_2021.dbo.PO_Podetails pod2
+on po2.POID = pod2.POID
+left join UFDATA_902_2021.dbo.SO_SODetails sod2
+on pod2.iorderdid = sod2.iSOsID
+left join UFDATA_902_2021.dbo.SO_SOMain so2
+on sod2.ID = so2.ID
+where po2.cVenCode not in ('T020001','T010001') and so2.csocode = 'FY2023-3200262328-PH2'
+
+union all
+
+select '903' as account, po3.cPOID  from UFDATA_903_2021.dbo.PO_Pomain po3
+left join UFDATA_903_2021.dbo.PO_Podetails pod3
+on po3.POID = pod3.POID
+left join UFDATA_903_2021.dbo.SO_SODetails sod3
+on pod3.iorderdid = sod3.iSOsID
+left join UFDATA_903_2021.dbo.SO_SOMain so3
+on sod3.ID = so3.ID
+where po3.cVenCode not in ('T020001','T010001') and so3.csocode = 'AW23-CONNOR-C23HO100'
+
+
+
+
     </select>
 
 

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

@@ -52,7 +52,9 @@ public class ProductionScheduleImpl extends ServiceImpl<ProductionScheduleMapper
     @Override
     @DS("multi-three")
     public List<ProductionSchedule> selectByView(QueryWrapper<ProductionSchedule> queryWrapper){
-        return productionScheduleMapper.selectByPage(queryWrapper);
+        //return productionScheduleMapper.selectByPage(queryWrapper);
+        String cc = "";
+        return productionScheduleMapper.selectPicture(cc);
     }
 
     @Override