zengtx пре 2 година
родитељ
комит
6a5064e17e

+ 7 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/mapper/xml/SyShippingDetailsMapper.xml

@@ -11,7 +11,13 @@
            b.distribution_point as distributionPoint,b.pack_id as packId,b.unit_price_including_tax as unitPriceIncludingTax,guangpei_gate_width as guangpeiGateWidth,
            b.supplier_code as supplierCode,a.garment_nmb as garmentNmb,b.garment_factory as garmentFactory,DATE_FORMAT(b.pre_delivery_date,'%Y-%m-%d') as preDeliveryDate,b.box_number as boxNumber,
            a.whole_order_total as wholeOrderTotal,a.sales_department as salesDepartment,a.salesman as salesman,a.currency_text as currencyText,a.third_party as thirdParty,
-            a.deposit_ratio as depositRatio,a.deposit as deposit,a.collaborative_route as collaborativeRoute,a.term_of_payment as termOfPayment,a.end_customer as endCustomer,
+            a.deposit_ratio as depositRatio,a.deposit as deposit,a.collaborative_route as collaborativeRoute,a.term_of_payment as termOfPayment,
+           if(left(b.inventory_ccode,2)='19',
+case a.customer_abbreviation
+when '森语集团' then a.end_customer
+when '宁波森语' then a.end_customer
+else a.customer_abbreviation end ,
+a.end_customer) as endCustomer,
              a.order_remarks as orderRemarks,a.price_remarks as priceRemarks,a.order_change_description as orderChangeDescription,b.supplier as supplier,b.i_tax_price as iTaxPrice,
              case when b.ymoney is null then '0' else b.ymoney end as ymoney,b.OMPO_id as OMPOId,b.inventory_ccode as inventoryCcode
              from sy_order_data_item b

+ 112 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/controller/FullSetRateController.java

@@ -0,0 +1,112 @@
+package org.jeecg.modules.report.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.log4j.Log4j2;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.report.entity.FullSetRate;
+import org.jeecg.modules.report.service.IFullSetRateService;
+import org.jeecg.modules.report.service.impl.FullSetRateServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+
+@Log4j2
+@RestController
+@RequestMapping("/report/fullSetRate")
+public class FullSetRateController extends JeecgController<FullSetRate, IFullSetRateService> {
+
+    @Autowired
+    private FullSetRateServiceImpl fullSetRateService;
+
+    /**
+     * 齐套率列表查询
+     * @param fullSetRate
+     * @return
+     */
+    @GetMapping(value = "/queryListInfo")
+    public Result<IPage<FullSetRate>> queryListInfo(FullSetRate fullSetRate,
+                                                    @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                    @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) throws ParseException {
+
+        Result<IPage<FullSetRate>> result = new Result<IPage<FullSetRate>>();
+        Page<FullSetRate> page = new Page<FullSetRate>(pageNo,pageSize);
+        QueryWrapper<FullSetRate> queryWrapper = new QueryWrapper<>();
+        if(oConvertUtils.isNotEmpty(fullSetRate.getPlanNo())){
+            queryWrapper.like("a.cCode",fullSetRate.getPlanNo());
+        }
+        queryWrapper.groupBy("a.MOID");
+        IPage<FullSetRate> pageList = fullSetRateService.queryListInfo(page,queryWrapper);
+
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
+        //最晚最早出库日期集合
+        List<String> moDeilsIDList = new ArrayList<>();
+
+        //累计准时出库数量
+        BigDecimal cumulativeOnTimeDeliveryQuantity = BigDecimal.ZERO;
+        //累计延迟出库数量
+        BigDecimal cumulativeDelayedDeliveryQty = BigDecimal.ZERO;
+
+        for(FullSetRate li:pageList.getRecords()){
+            //查询委外订单子表与发货或日期信息
+            List<FullSetRate> queryMomain = fullSetRateService.queryMOMain(li.getMoID());
+            //循环子表
+            for(FullSetRate momian:queryMomain){
+                moDeilsIDList.add(momian.getMODetailsID());
+                //查询销售出库单获取累计准时出库数量,获取累计延迟出库数量
+              List<FullSetRate> salesIssueList = fullSetRateService.querySalesIssue(momian.getMODetailsID());
+                for(FullSetRate sa:salesIssueList){
+                    Long saTime = sf.parse(sa.getDeliveryDate()).getTime();
+                    Long moTime = sf.parse(momian.getDeliveryDate()).getTime();
+
+                    //大于就是延迟出库
+                    if(saTime > moTime){
+                        cumulativeDelayedDeliveryQty = cumulativeDelayedDeliveryQty.add(sa.getCumulativeOnTimeDeliveryQuantity());
+                    }
+                    //小于等于就是准时出库
+                    if(saTime <= moTime){
+                        cumulativeOnTimeDeliveryQuantity = cumulativeOnTimeDeliveryQuantity.add(sa.getCumulativeOnTimeDeliveryQuantity());
+                    }
+                }
+            }
+            //累计准时出库数量赋值
+            li.setCumulativeOnTimeDeliveryQuantity(cumulativeOnTimeDeliveryQuantity);
+            //累计延迟出库数量赋值
+            li.setCumulativeDelayedDeliveryQty(cumulativeDelayedDeliveryQty);
+            //预计发货日期(最早)赋值
+            li.setEstimatedDeliveryDate(queryMomain.get(0).getDeliveryDate());
+            //最早出库日期赋值,最晚出库日期赋值
+            List<FullSetRate> dateTimeList = fullSetRateService.querySalesIssueDate(moDeilsIDList);
+            li.setEarliestIssueDate(dateTimeList.get(dateTimeList.size()-1).getDeliveryDate());
+            li.setLatestIssueDate(dateTimeList.get(0).getDeliveryDate());
+            //出库率赋值(销售订单累计出库数量/销售订单数量)
+            BigDecimal deliveryRate = li.getCumulativeIssueQuantity().divide(li.getSalesOrderQuantity(),2,BigDecimal.ROUND_FLOOR);
+            li.setDeliveryRate(deliveryRate);
+
+
+        }
+
+        result.setMessage("查询成功!");
+        result.setSuccess(true);
+        result.setResult(pageList);
+
+        return result;
+
+    }
+
+}

+ 64 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/entity/FullSetRate.java

@@ -0,0 +1,64 @@
+package org.jeecg.modules.report.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.math.BigDecimal;
+
+/**
+ * 齐套率报表列表实体类
+ */
+@Data
+public class FullSetRate {
+
+    //出库齐套
+    private int fullSetOfDelivery;
+    //来源订单号
+    private String sourceOrderNo;
+    //款号
+    private java.lang.String styleNumber;
+    //销售订单数量
+    private BigDecimal salesOrderQuantity;
+    //订单编号
+    private String subcontractOrderNo;
+    //订单数量
+    private String subcontractOrderQuantity;
+    //交期
+    private String deliveryDate;
+    //部门
+    private String department;
+    //业务员
+    private String salesman;
+    //存货上游订单数量
+    private BigDecimal salesOrderQuantity1;
+    //累计出库数量
+    private BigDecimal cumulativeIssueQuantity;
+    //累计准时出库数量
+    private BigDecimal cumulativeOnTimeDeliveryQuantity;
+    //累计延迟出库数量
+    private BigDecimal cumulativeDelayedDeliveryQty;
+    //未出库数量
+    private BigDecimal quantityNotIssued;
+    //预计发货日期
+    private String estimatedDeliveryDate;
+    //最早出库日期
+    private String earliestIssueDate;
+    //最晚出库日期
+    private String latestIssueDate;
+    //出库率
+    private BigDecimal deliveryRate;
+    //区间出库率
+    private BigDecimal intervalDeliveryRate;
+    //齐套率
+    private String fullSetRate;
+
+
+    //其他条件所需字段
+    private String MODetailsID;
+    private String moID;
+
+    //查询条件所需字段
+    private String planNo;
+
+}

+ 26 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/mapper/FullSetRateMapper.java

@@ -0,0 +1,26 @@
+package org.jeecg.modules.report.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.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.report.entity.FullSetRate;
+
+import java.util.List;
+
+public interface FullSetRateMapper extends BaseMapper<FullSetRate> {
+
+    //查询列表页面
+    public IPage<FullSetRate> queryListInfo(IPage<FullSetRate> page,@Param("ew") QueryWrapper<FullSetRate> queryWrapper);
+
+    //查询销售出库单 获取累计准时出库数量,累计延迟出库数量
+    public List<FullSetRate> querySalesIssue(@Param("moDeilsID") String moDeilsID);
+
+    //查询委外订单子表信息
+    public List<FullSetRate> queryMOMain(@Param("moId") String moId);
+
+    //查询销售出库单获取最早最晚出库日期
+    public List<FullSetRate> querySalesIssueDate(@Param("moDeilsID") List<String> moDeilsID);
+}

+ 53 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/mapper/xml/FullSetTateMapper.xml

@@ -0,0 +1,53 @@
+<?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.report.mapper.FullSetRateMapper">
+    
+    <select id="queryListInfo" resultType="org.jeecg.modules.report.entity.FullSetRate">
+
+        select a.MOID,min(b.csoordercode) as sourceOrderNo,max(c.cDefine22) as styleNumber,
+        sum(c.iQuantity) as salesOrderQuantity,min(a.cCode) as subcontractOrderNo,sum(b.iQuantity) as subcontractOrderQuantity,
+        min(c.dPreDate) as deliveryDate,min(d.cDepName) as department,min(p.cPersonName) as salesman,
+        sum(c.iQuantity) as salesOrderQuantity1,sum(c.iFHQuantity) as cumulativeIssueQuantity,
+        (sum(c.iQuantity)-sum(c.iFHQuantity)) as quantityNotIssued from OM_MOMain a
+left join OM_MODetails b
+on a.MOID = b.MOID
+left join SO_SODetails c
+on b.isosid = c.iSOsID
+left join Department d
+on a.cDepCode = d.cDepCode
+left join Person p
+on a.cPersonCode = p.cPersonCode
+${ew.customSqlSegment}
+
+    </select>
+
+    <select id="querySalesIssue"  resultType="org.jeecg.modules.report.entity.FullSetRate">
+
+    select a.dDate as deliveryDate,b.iQuantity as cumulativeOnTimeDeliveryQuantity from rdrecord32 a
+    left join rdrecords32 b
+    on a.ID = b.ID
+    where b.iorderdid = #{moDeilsID}
+    </select>
+
+    <select id="queryMOMain" resultType="org.jeecg.modules.report.entity.FullSetRate">
+
+      select a.isosid as MODetailsID,b.dPreDate as deliveryDate from OM_MODetails a
+        left join SO_SODetails b
+        on a.isosid = b.iSOsID
+        where a.MOID = #{moId}
+        order by b.dPreDate asc
+
+    </select>
+
+    <select id="querySalesIssueDate" resultType="org.jeecg.modules.report.entity.FullSetRate">
+        select a.dDate as deliveryDate from rdrecord32 a
+    left join rdrecords32 b
+    on a.ID = b.ID
+    where b.iorderdid in
+    <foreach collection="moDeilsID" item="item" separator="," open="(" close=")">
+        #{item}
+    </foreach>
+    order by a.dDate desc
+    </select>
+
+</mapper>

+ 29 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/service/IFullSetRateService.java

@@ -0,0 +1,29 @@
+package org.jeecg.modules.report.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.report.entity.FullSetRate;
+import org.jeecg.modules.report.entity.SoSoDetails;
+
+import java.util.List;
+
+
+/**
+ * 齐套率报表
+ */
+public interface IFullSetRateService extends IService<FullSetRate> {
+
+    //查询列表页面
+    public IPage<FullSetRate> queryListInfo(IPage<FullSetRate> page, QueryWrapper<FullSetRate> queryWrapper);
+
+    //查询销售出库单
+    public List<FullSetRate> querySalesIssue(String moDeilsID);
+
+    //查询委外订单子表每条预发货日期信息
+    public List<FullSetRate> queryMOMain(String moId);
+
+    //查询销售出库单获取最早最晚出库日期
+    public List<FullSetRate> querySalesIssueDate(List<String> moDeilsID);
+}

+ 46 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/service/impl/FullSetRateServiceImpl.java

@@ -0,0 +1,46 @@
+package org.jeecg.modules.report.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.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.report.entity.FullSetRate;
+import org.jeecg.modules.report.mapper.FullSetRateMapper;
+import org.jeecg.modules.report.service.IFullSetRateService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 齐套率报表
+ */
+@Service
+@DS("multi-one")
+public class FullSetRateServiceImpl extends ServiceImpl<FullSetRateMapper, FullSetRate> implements IFullSetRateService {
+
+    @Resource
+    private FullSetRateMapper fullSetRateMapper;
+
+    @Override
+    public IPage<FullSetRate> queryListInfo(IPage<FullSetRate> page, QueryWrapper<FullSetRate> queryWrapper) {
+        return fullSetRateMapper.queryListInfo(page,queryWrapper);
+    }
+
+    @Override
+    public List<FullSetRate> querySalesIssue(String moDeilsID) {
+        return fullSetRateMapper.querySalesIssue(moDeilsID);
+    }
+
+    @Override
+    public List<FullSetRate> queryMOMain(String moId) {
+        return fullSetRateMapper.queryMOMain(moId);
+    }
+
+    @Override
+    public List<FullSetRate> querySalesIssueDate(List<String> moDeilsID) {
+        return fullSetRateMapper.querySalesIssueDate(moDeilsID);
+    }
+}