add:统计分析

This commit is contained in:
zhangzhiqiang
2023-10-08 10:22:18 +08:00
parent d20e5f8282
commit 418b40f683
18 changed files with 1566 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package org.nl.wms.analysis_manage.workTask.controller;
/*
* @author ZZQ
* @Date 2023/10/7 10:07
*/
import lombok.extern.slf4j.Slf4j;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
import org.nl.wms.product_manage.service.workorder.dto.WorkorderQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/workingGood")
@Slf4j
public class WorkTaskController {
@Autowired
private IPdmProduceWorkorderService iPdmProduceWorkorderService;
@GetMapping
@Log("查询工单管理")
//("查询工单管理")
public ResponseEntity<Object> query(WorkorderQuery query, PageQuery page) {
return new ResponseEntity<>(iPdmProduceWorkorderService.queryAll(query, page), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,62 @@
package org.nl.wms.analysis_manage.workingGoods.controller;
/*
* @author ZZQ
* @Date 2023/10/7 10:07
*/
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.TableDataInfo;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
import org.nl.wms.product_manage.service.processroute.dto.ProcessrouteQuery;
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api/workinggood")
@Slf4j
public class WorkingGoodController {
@Autowired
private IPdmProduceWorkorderService workorderService;
@GetMapping("/byMaterial")
@Log("根据物料查询在制品")
public ResponseEntity<Object> byMaterial(ByProcessQuery query,PageQuery page) {
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
List<Map> list = workorderService.goodAnilysis(query);
TableDataInfo build = TableDataInfo.build(list);
build.setTotalElements(result.getTotal());
return new ResponseEntity<>(build, HttpStatus.OK);
}
@GetMapping("/byworkprocess")
@Log("根据工序查询在制品")
public ResponseEntity<Object> byworkprocess(ByProcessQuery json,PageQuery page) {
//workorderService.getDtl(json),
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/processDtl")
@Log("工序编码在制品详情")
public ResponseEntity<Object> processDtl(ByProcessQuery json,PageQuery page) {
//workorderService.getDtl(json),
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,23 @@
package org.nl.wms.analysis_manage.workingGoods.service.dto;
/*
* @author ZZQ
* @Date 2023/10/7 10:11
*/
public class ByMaterialQuery {
public void sdfds(){
System.out.println(this.getClass().getName()+"调用方法");
}
@Override
protected void finalize() throws Throwable {
System.out.println("对象被释放");
}
}
class demo{
public static void main(String[] args) {
ByMaterialQuery query = new ByMaterialQuery();
query.sdfds();
}
}

View File

@@ -0,0 +1,44 @@
package org.nl.wms.analysis_manage.workingGoods.service.dto;
import lombok.Data;
/*
* @author ZZQ
* @Date 2023/10/7 10:11
*/
public class ByProcessQuery {
private String product_area;
private String blurry;
private String[] create_time;
private String start_time;
private String end_time;
public String getProduct_area() {
return product_area;
}
public void setProduct_area(String product_area) {
this.product_area = product_area;
}
public String getBlurry() {
return blurry;
}
public void setBlurry(String blurry) {
this.blurry = blurry;
}
public String[] getCreate_time() {
return create_time;
}
public void setCreate_time(String[] create_time) {
this.create_time = create_time;
if (create_time!=null && create_time.length == 2){
this.start_time = create_time[0];
this.end_time = create_time[1];
}
}
}

View File

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
import org.nl.wms.product_manage.service.workorder.dao.PdmProduceWorkorder;
import org.nl.wms.product_manage.service.workorder.dto.PdmProduceWorkorderDto;
import org.nl.wms.product_manage.service.workorder.dto.ReportQuery;
@@ -154,6 +155,8 @@ public interface IPdmProduceWorkorderService extends IService<PdmProduceWorkorde
List<Map> reportQuery(ReportQuery query);
List<Map> goodAnilysis(ByProcessQuery query);
void download(Map map, HttpServletResponse response)
throws IOException;
}

View File

@@ -3,6 +3,7 @@ package org.nl.wms.product_manage.service.workorder.dao.mapper;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
import org.nl.wms.product_manage.service.workorder.dao.PdmProduceWorkorder;
import org.nl.wms.product_manage.service.workorder.dto.PdmProduceWorkorderDto;
import org.nl.wms.product_manage.service.workorder.dto.WorkorderQuery;
@@ -39,4 +40,11 @@ public interface PdmProduceWorkorderMapper extends BaseMapper<PdmProduceWorkorde
*/
void insertBatch(@Param("entities") List<PdmProduceWorkorder> entities);
/**
* 在制品分析
* @param query
* @return
*/
List<Map> goodAnalysis(ByProcessQuery query);
}

View File

@@ -228,5 +228,47 @@
</foreach>
</insert>
<select id="goodAnalysis" resultType="java.util.Map">
SELECT
sum( pdm_produce_workorder.real_qty ) real_qty,
sum( pdm_produce_workorder.dq_real_qty ) dq_real_qty,
sum( pdm_produce_workorder.nok_qty ) nok_qty,
md_me_materialbase.material_name,
md_me_materialbase.material_spec,
sum( pdm_produce_workorder.real_qty )*rate_qty*1000 as rate_weight,
sum( pdm_produce_workorder.real_qty )*md_me_materialbase.net_weight as product_weight,
if(sum(pdm_produce_workorder.real_qty )>0,sum( pdm_produce_workorder.real_qty )*md_me_materialbase.net_weight/(sum( pdm_produce_workorder.real_qty )*rate_qty*1000),1) as yield_rate,
if(sum(pdm_produce_workorder.real_qty )>0,sum( pdm_produce_workorder.nok_qty )/sum(pdm_produce_workorder.real_qty ),0) as nok_rate,
if(sum(pdm_produce_workorder.real_qty )>0,1-sum( pdm_produce_workorder.nok_qty )/sum(pdm_produce_workorder.real_qty ),1) as endproduct_rate,
MD_ME_SemiRealRawMaterial.raw_material_code,
pdm_bi_workprocedure.workprocedure_name,
md_me_materialbase.material_code
FROM
pdm_produce_workorder
LEFT JOIN pdm_bi_workprocedure ON pdm_produce_workorder.workprocedure_id = pdm_bi_workprocedure.workprocedure_id
LEFT JOIN md_me_materialbase ON pdm_produce_workorder.material_id = md_me_materialbase.material_id
LEFT JOIN MD_ME_SemiRealRawMaterial ON pdm_produce_workorder.material_id = MD_ME_SemiRealRawMaterial.semi_material_id
WHERE
pdm_bi_workprocedure.is_first = '1'
AND md_me_materialbase.material_code IS NOT NULL
<if test="start_time != null and start_time != ''">
and pdm_produce_workorder.create_time >= #{start_time}
</if>
<if test="product_area != null and product_area != ''">
and pdm_produce_workorder.product_area >= #{product_area}
</if>
<if test="start_time != null and start_time != ''">
and #{end_time} >= pdm_produce_workorder.create_time
</if>
<if test="blurry != null and blurry != ''">
and (
md_me_materialbase.material_code like '%${blurry}%' or
md_me_materialbase.material_spec like '%${blurry}%' )
</if>
GROUP BY
md_me_materialbase.material_code,
pdm_bi_workprocedure.workprocedure_name
</select>
</mapper>

View File

@@ -28,6 +28,7 @@ import org.nl.common.utils.api.RestBusinessTemplate;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.system.util.CodeUtil;
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
import org.nl.wms.ext_manage.acs.service.WmsToAcsService;
import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstandardService;
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
@@ -870,4 +871,9 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
public List<PdmProduceWorkorderDto> getOrderByDevLimit(Map<String,String> param) {
return this.baseMapper.orderListByDevLimit(param);
}
@Override
public List<Map> goodAnilysis(ByProcessQuery query) {
return this.baseMapper.goodAnalysis(query);
}
}

View File

@@ -0,0 +1 @@
INSERT INTO `hl_one_mes`.`sys_menu`(`menu_id`, `pid`, `sub_count`, `type`, `title`, `component_name`, `component`, `menu_sort`, `icon`, `path`, `iframe`, `cache`, `hidden`, `permission`, `create_name`, `update_name`, `create_time`, `update_time`, `is_pc`, `system_type`, `create_id`, `category`, `update_id`) VALUES ('1710496480147673088', '1710494665352024064', 0, 2, '在制品分析', NULL, 'wms/analysis_manage/workingGoods/indexByMaterial', 999, 'chart', 'workgoodbymaterial', 0, b'0', b'0', NULL, NULL, NULL, '2021-11-04 15:35:31', NULL, 1, '1', 1, NULL, NULL);