rev:添加质检功能

This commit is contained in:
zhouz
2023-06-21 18:51:35 +08:00
parent 865fbe58f4
commit b4cfd1aa59
37 changed files with 899 additions and 581 deletions

View File

@@ -17,6 +17,16 @@ public enum QueryTEnum {
EQ((q, k, v) -> { q.eq(k[0],v); }),
IN((q, key, o) -> { if (o instanceof Collection){ q.in(key[0],(Collection) o); } }),
LK((q, keys, o) -> { for (String key : keys) { q.like(key,o); } }),
ORLK((q, k, o) -> { q.and(query -> {
QueryWrapper queryWrapper = (QueryWrapper) query;
for (int i = 0; i < k.length; i++) {
queryWrapper.like(k[i],o);
if (i != (k.length-1)){
queryWrapper.or();
}
}
});
}),
LE((q, k, v) -> { q.le(k[0],v); }),
BY((q, k, v) -> { q.orderByDesc(k[0],v); }),
NO((q, k, v) -> { q.isNull(k[0]); }),

View File

@@ -1,19 +1,18 @@
package org.nl.wms.quality_manage.controller.inspection;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.quality_manage.service.inspection.IQlTestInspectionitempointService;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionitempoint;
import org.nl.wms.quality_manage.service.inspection.dto.ItemPointQuery;
import org.nl.wms.storage_manage.semimanage.service.check.dto.CheckQuery;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* <p>
@@ -36,5 +35,32 @@ public class QlTestInspectionitempointController {
public ResponseEntity<Object> query(ItemPointQuery query, PageQuery page) {
return new ResponseEntity<>(inspectionitempointService.pageQuery(query, page), HttpStatus.OK);
}
@PostMapping
@Log("新增检测项点")
@ApiOperation("新增检测项点")
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
inspectionitempointService.create(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/update")
@Log("修改检测项点")
@ApiOperation("修改检测项点")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
inspectionitempointService.update(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("delete")
@Log("修改检测项点")
@ApiOperation("新增检测项点")
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
for (Long id : ids) {
inspectionitempointService.removeById(id);
}
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -1,9 +1,19 @@
package org.nl.wms.quality_manage.controller.inspection;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiOperation;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.quality_manage.service.inspection.IQlTestInspectionschemedtlproductstandardService;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtlproductstandard;
import org.nl.wms.quality_manage.service.inspection.dto.StandardQuery;
import org.nl.wms.storage_manage.semimanage.service.iostorInv.dto.BcpIostorInvQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/**
* <p>
@@ -14,8 +24,43 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2023-05-06
*/
@RestController
@RequestMapping("/qlTestInspectionschemedtlproductstandard")
@RequestMapping("/api/productStandard")
public class QlTestInspectionschemedtlproductstandardController {
@Autowired
private IQlTestInspectionschemedtlproductstandardService standardService;
@PostMapping("/saveData")
@Log("新增检测方案标准")
@ApiOperation("新增检测方案标准")
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
standardService.saveData(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping
@Log("查询检测方案标准")
@ApiOperation("查询检测方案标准")
public ResponseEntity<Object> query(StandardQuery query, PageQuery page) {
return new ResponseEntity<>(standardService.query(query, page), HttpStatus.OK);
}
@PostMapping("/getDtl")
@Log("查询检测方案标准明细")
@ApiOperation("查询检测方案标准明细")
public ResponseEntity<Object> query(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(standardService.getDtl(whereJson), HttpStatus.OK);
}
@PostMapping("/delete")
@Log("删除检测方案标准")
@ApiOperation("删除检测方案标准")
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
for (Long id : ids){
standardService.remove(new QueryWrapper<QlTestInspectionschemedtlproductstandard>()
.lambda().eq(QlTestInspectionschemedtlproductstandard::getMaterial_id,id));
}
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -1,9 +1,22 @@
package org.nl.wms.quality_manage.controller.inspection;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.swagger.annotations.ApiOperation;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.quality_manage.service.inspection.IQlTestInspectionschemedtlService;
import org.nl.wms.quality_manage.service.inspection.IQlTestInspectionschememstService;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtl;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
import org.nl.wms.quality_manage.service.inspection.dto.ItemPointQuery;
import org.nl.wms.quality_manage.service.inspection.dto.SchemeQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/**
* <p>
@@ -14,8 +27,62 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2023-05-06
*/
@RestController
@RequestMapping("/qlTestInspectionschememst")
@RequestMapping("/api/inspectionSchemeMst")
public class QlTestInspectionschememstController {
@Autowired
private IQlTestInspectionschememstService inspectionschememstService;
@Autowired
private IQlTestInspectionschemedtlService inspectionschemedtlService;
@GetMapping
@Log("查询检测方案")
@ApiOperation("查询检测方案")
public ResponseEntity<Object> query(SchemeQuery query, PageQuery page) {
return new ResponseEntity<>(inspectionschememstService.pageQuery(query, page), HttpStatus.OK);
}
@PostMapping
@Log("新增检测方案")
@ApiOperation("新增检测方案")
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
inspectionschememstService.create(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/update")
@Log("修改检测方案")
@ApiOperation("修改检测方案")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
inspectionschememstService.update(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/delete")
@Log("删除检测方案")
@ApiOperation("删除检测方案")
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
for (Long id : ids) {
inspectionschememstService.removeById(id);
inspectionschemedtlService.remove(new QueryWrapper<QlTestInspectionschemedtl>().lambda().eq(QlTestInspectionschemedtl::getInspection_scheme_id, id));
}
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/getDtl")
@Log("获取方案明细")
@ApiOperation("获取方案明细")
public ResponseEntity<Object> getDtl(@RequestBody QlTestInspectionschememst mst) {
return new ResponseEntity<>(inspectionschemedtlService.getDtl(mst),HttpStatus.OK);
}
@PostMapping("/selectList")
@Log("检测方案下拉框")
@ApiOperation("检测方案下拉框")
public ResponseEntity<Object> selectList() {
return new ResponseEntity<>(inspectionschememstService.list(new QueryWrapper<QlTestInspectionschememst>().lambda().eq(QlTestInspectionschememst::getIs_used,true)),HttpStatus.OK);
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.wms.quality_manage.service.inspection;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionitempoint;
@@ -17,4 +18,7 @@ public interface IQlTestInspectionitempointService extends IService<QlTestInspec
Object pageQuery(ItemPointQuery query, PageQuery page);
void create(JSONObject jo);
void update(JSONObject jo);
}

View File

@@ -1,7 +1,14 @@
package org.nl.wms.quality_manage.service.inspection;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtl;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
import org.nl.wms.storage_manage.semimanage.service.check.dao.StIvtCheckmstBcp;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -12,5 +19,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @since 2023-05-06
*/
public interface IQlTestInspectionschemedtlService extends IService<QlTestInspectionschemedtl> {
double create(JSONArray rows, QlTestInspectionschememst mst);
List<Map> getDtl(QlTestInspectionschememst mst);
}

View File

@@ -1,7 +1,14 @@
package org.nl.wms.quality_manage.service.inspection;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtlproductstandard;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtlproductstandard;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
import org.nl.wms.quality_manage.service.inspection.dto.StandardQuery;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -13,4 +20,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IQlTestInspectionschemedtlproductstandardService extends IService<QlTestInspectionschemedtlproductstandard> {
void saveData(JSONObject jo);
Object query(StandardQuery query, PageQuery page);
List<Map> getDtl(JSONObject whereJson);
}

View File

@@ -1,7 +1,10 @@
package org.nl.wms.quality_manage.service.inspection;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
import org.nl.wms.quality_manage.service.inspection.dto.SchemeQuery;
/**
* <p>
@@ -13,4 +16,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IQlTestInspectionschememstService extends IService<QlTestInspectionschememst> {
Object pageQuery(SchemeQuery query, PageQuery page);
void create(JSONObject jo);
void update(JSONObject jo);
}

View File

@@ -1,5 +1,6 @@
package org.nl.wms.quality_manage.service.inspection.dao;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import java.io.Serializable;
@@ -24,6 +25,7 @@ public class QlTestInspectionitempoint implements Serializable {
/**
* 项点标识
*/
@TableId
private String inspection_item_id;
/**
@@ -74,7 +76,7 @@ public class QlTestInspectionitempoint implements Serializable {
/**
* 创建时间
*/
private Date create_time;
private String create_time;
/**
* 修改人
@@ -89,7 +91,7 @@ public class QlTestInspectionitempoint implements Serializable {
/**
* 修改时间
*/
private Date update_time;
private String update_time;
/**
* 是否临界值填充备注

View File

@@ -1,6 +1,8 @@
package org.nl.wms.quality_manage.service.inspection.dao;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import java.io.Serializable;
@@ -25,6 +27,7 @@ public class QlTestInspectionschememst implements Serializable {
/**
* 检验方案标识
*/
@TableId
private String inspection_scheme_id;
/**
@@ -43,19 +46,9 @@ public class QlTestInspectionschememst implements Serializable {
private String inspection_scheme_type;
/**
* 厂家质保项数量
* 明细项
*/
private BigDecimal factory_qty;
/**
* 工序检验项数量
*/
private BigDecimal workprocedure_qty;
/**
* 理化检验项数量
*/
private BigDecimal physical_qty;
private BigDecimal detail_count;
/**
* 备注
@@ -80,7 +73,7 @@ public class QlTestInspectionschememst implements Serializable {
/**
* 创建时间
*/
private Date create_time;
private String create_time;
/**
* 修改人
@@ -95,7 +88,7 @@ public class QlTestInspectionschememst implements Serializable {
/**
* 修改时间
*/
private Date update_time;
private String update_time;
}

View File

@@ -1,7 +1,12 @@
package org.nl.wms.quality_manage.service.inspection.dao.mapper;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -13,4 +18,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface QlTestInspectionschemedtlMapper extends BaseMapper<QlTestInspectionschemedtl> {
List<Map> getDtl(@Param("mst") QlTestInspectionschememst mst);
}

View File

@@ -2,4 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.quality_manage.service.inspection.dao.mapper.QlTestInspectionschemedtlMapper">
<select id="getDtl" resultType="java.util.Map">
select
dtl.*,
qti.inspection_item_type,
qti.inspection_type
from
ql_test_inspectionschemedtl dtl
left join ql_test_inspectionitempoint qti on dtl.inspection_item_code = qti.inspection_item_code
<where>
<if test="mst.inspection_scheme_id != null">
dtl.inspection_scheme_id = #{mst.inspection_scheme_id}
</if>
</where>
order by dtl.order_index
</select>
</mapper>

View File

@@ -1,7 +1,13 @@
package org.nl.wms.quality_manage.service.inspection.dao.mapper;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtlproductstandard;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtlproductstandard;
import org.nl.wms.quality_manage.service.inspection.dto.StandardQuery;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -13,4 +19,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface QlTestInspectionschemedtlproductstandardMapper extends BaseMapper<QlTestInspectionschemedtlproductstandard> {
List<Map> getDtl(@Param("query") StandardQuery query);
List<Map> queryDtl(@Param("form") JSONObject form);
}

View File

@@ -2,4 +2,54 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.quality_manage.service.inspection.dao.mapper.QlTestInspectionschemedtlproductstandardMapper">
<select id="getDtl" resultType="java.util.Map">
SELECT
a.*,
mst.inspection_scheme_type,
mb.material_code,
mb.material_name
FROM
(
SELECT
stand.material_id,
MAX( stand.inspection_scheme_code ) AS inspection_scheme_code,
MAX( stand.inspection_scheme_name ) AS inspection_scheme_name,
MAX( stand.inspection_scheme_id ) AS inspection_scheme_id,
COUNT( stand.material_id ) AS detail_count
FROM
ql_test_inspectionschemedtlproductstandard stand
GROUP BY
stand.material_id) a
LEFT JOIN md_me_materialbase mb ON mb.material_id = a.material_id
LEFT JOIN ql_test_inspectionschememst mst ON a.inspection_scheme_code = mst.inspection_scheme_code
<where>
<if test="query.material_search != null and query.material_search != ''">
AND (mb.material_code like '%${query.material_search}%' OR mb.material_name like
'%${query.material_search}%')
</if>
<if test="query.inspection_scheme_search != null and query.inspection_scheme_search != ''">
AND (a.inspection_scheme_name like '%${query.inspection_scheme_search}%' OR a.inspection_scheme_code
like '%${query.inspection_scheme_search}%')
</if>
<if test="query.inspection_scheme_type != null and query.inspection_scheme_type != ''">
AND mst.inspection_scheme_type = #{query.inspection_scheme_type}
</if>
</where>
</select>
<select id="queryDtl" resultType="java.util.Map" parameterType="com.alibaba.fastjson.JSONObject">
SELECT
stand.*,
mst.inspection_scheme_type,
point.inspection_item_type,
point.inspection_type
FROM
ql_test_inspectionschemedtlproductstandard stand
LEFT JOIN ql_test_inspectionschememst mst ON mst.inspection_scheme_code = stand.inspection_scheme_code
LEFT JOIN ql_test_inspectionitempoint point ON point.inspection_item_id = stand.inspection_item_id
<where>
<if test="form.material != null">
AND stand.material_id = #{form.material_id}
</if>
</where>
</select>
</mapper>

View File

@@ -19,4 +19,12 @@ public class ItemPointQuery extends BaseQuery<QlTestInspectionitempoint> {
private String inspection_type;
private String item_search;
@Override
public void paramMapping() {
super.doP.put("item_search", QParam.builder().k(new String[]{"inspection_item_code","inspection_item_name"}).type(QueryTEnum.ORLK).build());
}
}

View File

@@ -0,0 +1,28 @@
package org.nl.wms.quality_manage.service.inspection.dto;
import lombok.Data;
import org.nl.common.domain.query.BaseQuery;
import org.nl.common.domain.query.QParam;
import org.nl.common.enums.QueryTEnum;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionitempoint;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
/*
* @author ZZQ
* @Date 2023/5/4 19:49
*/
@Data
public class SchemeQuery extends BaseQuery<QlTestInspectionschememst> {
private String inspection_scheme_type;
private String sch_search;
@Override
public void paramMapping() {
super.doP.put("sch_search", QParam.builder().k(new String[]{"inspection_scheme_code","inspection_scheme_name"}).type(QueryTEnum.ORLK).build());
}
}

View File

@@ -0,0 +1,24 @@
package org.nl.wms.quality_manage.service.inspection.dto;
import lombok.Data;
import org.nl.common.domain.query.BaseQuery;
import org.nl.common.domain.query.QParam;
import org.nl.common.enums.QueryTEnum;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtlproductstandard;
import org.nl.wms.storage_manage.semimanage.service.iostorInv.dao.StIvtIostorinvBcp;
/*
* @author ZZQ
* @Date 2023/5/4 19:49
*/
@Data
public class StandardQuery extends BaseQuery<QlTestInspectionschemedtlproductstandard> {
private String material_search;
private String inspection_scheme_type;
private String inspection_scheme_search;
}

View File

@@ -1,17 +1,32 @@
package org.nl.wms.quality_manage.service.inspection.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.jsonwebtoken.lang.Assert;
import org.jetbrains.annotations.NotNull;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtBsrealstorattr;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionitempoint;
import org.nl.wms.quality_manage.service.inspection.dao.mapper.QlTestInspectionitempointMapper;
import org.nl.wms.quality_manage.service.inspection.IQlTestInspectionitempointService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.quality_manage.service.inspection.dto.ItemPointQuery;
import org.nl.wms.storage_manage.CHECKEnum;
import org.nl.wms.storage_manage.semimanage.service.check.dao.StIvtCheckmstBcp;
import org.nl.wms.storage_manage.semimanage.service.check.dto.CheckQuery;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* <p>
* 检验项点表 服务实现类
@@ -22,11 +37,54 @@ import org.springframework.stereotype.Service;
*/
@Service
public class QlTestInspectionitempointServiceImpl extends ServiceImpl<QlTestInspectionitempointMapper, QlTestInspectionitempoint> implements IQlTestInspectionitempointService {
@Override
public void create(JSONObject jo) {
QlTestInspectionitempoint mstForm = packageMstForm(new QlTestInspectionitempoint(), jo);
String item_code = mstForm.getInspection_item_code();
QlTestInspectionitempoint one = this.getOne(new QueryWrapper<QlTestInspectionitempoint>().lambda().eq(QlTestInspectionitempoint::getInspection_item_code, item_code));
if (ObjectUtil.isNotEmpty(one)) {
throw new BadRequestException("编码已存在!");
}
this.save(mstForm);
}
@Override
public void update(JSONObject form) {
Assert.notNull(new Object[]{form, form.get("inspection_item_id")}, "请求参数不能为空");
QlTestInspectionitempoint mst = form.toJavaObject(QlTestInspectionitempoint.class);
String item_code = mst.getInspection_item_code();
QlTestInspectionitempoint one = this.getOne(new QueryWrapper<QlTestInspectionitempoint>().lambda().eq(QlTestInspectionitempoint::getInspection_item_code, item_code));
if (ObjectUtil.isNotEmpty(one) && !one.getInspection_item_id().equals(mst.getInspection_item_id())) {
throw new BadRequestException("编码已存在!");
}
mst.setUpdate_id(SecurityUtils.getCurrentUserId());
mst.setUpdate_name(SecurityUtils.getCurrentNickName());
mst.setUpdate_time(DateUtil.now());
this.updateById(mst);
}
@Override
public Object pageQuery(ItemPointQuery query, PageQuery page) {
// 分页查询
QueryWrapper<QlTestInspectionitempoint> queryWrapper = new QueryWrapper<>();
Page<QlTestInspectionitempoint> pageQuery = this.page(page.build(), query.build());
TableDataInfo<QlTestInspectionitempoint> build = TableDataInfo.build(pageQuery);
return build;
}
@NotNull
private QlTestInspectionitempoint packageMstForm(QlTestInspectionitempoint itempoint, JSONObject whereJson) {
itempoint.setInspection_item_id(IdUtil.getStringId());
itempoint.setInspection_item_code(whereJson.getString("inspection_item_code"));
itempoint.setInspection_item_name(whereJson.getString("inspection_item_name"));
itempoint.setInspection_item_type(whereJson.getString("inspection_item_type"));
itempoint.setInspection_type(whereJson.getString("inspection_type"));
itempoint.setMaterial_id(whereJson.getString("material_id"));
itempoint.setMaterial_code(whereJson.getString("material_code"));
itempoint.setRemark(whereJson.getString("remark"));
itempoint.setCreate_id(SecurityUtils.getCurrentUserId());
itempoint.setCreate_name(SecurityUtils.getCurrentNickName());
itempoint.setCreate_time(DateUtil.now());
return itempoint;
}
}

View File

@@ -1,11 +1,19 @@
package org.nl.wms.quality_manage.service.inspection.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.nl.common.utils.IdUtil;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtl;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
import org.nl.wms.quality_manage.service.inspection.dao.mapper.QlTestInspectionschemedtlMapper;
import org.nl.wms.quality_manage.service.inspection.IQlTestInspectionschemedtlService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* <p>
* 检验方案明细表 服务实现类
@@ -17,4 +25,29 @@ import org.springframework.stereotype.Service;
@Service
public class QlTestInspectionschemedtlServiceImpl extends ServiceImpl<QlTestInspectionschemedtlMapper, QlTestInspectionschemedtl> implements IQlTestInspectionschemedtlService {
@Override
public List<Map> getDtl(QlTestInspectionschememst mst) {
return this.baseMapper.getDtl(mst);
}
@Override
public double create(JSONArray rows, QlTestInspectionschememst mst) {
//插入明细之前把所有的明细先删除
this.remove(new QueryWrapper<QlTestInspectionschemedtl>().lambda().eq(QlTestInspectionschemedtl::getInspection_scheme_id, mst.getInspection_scheme_id()));
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
QlTestInspectionschemedtl dtl = new QlTestInspectionschemedtl();
dtl.setInspection_scheme_dtl_id(IdUtil.getStringId());
dtl.setInspection_scheme_id(mst.getInspection_scheme_id());
dtl.setInspection_scheme_code(mst.getInspection_scheme_code());
dtl.setInspection_scheme_name(mst.getInspection_scheme_name());
dtl.setInspection_item_id(row.getString("inspection_item_id"));
dtl.setInspection_item_code(row.getString("inspection_item_code"));
dtl.setInspection_item_name(row.getString("inspection_item_name"));
dtl.setRemark(row.getString("remark"));
dtl.setOrder_index(row.getInteger("order_index"));
this.save(dtl);
}
return rows.size();
}
}

View File

@@ -1,11 +1,32 @@
package org.nl.wms.quality_manage.service.inspection.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.jetbrains.annotations.NotNull;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.wms.quality_manage.service.inspection.IQlTestInspectionschememstService;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschemedtlproductstandard;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
import org.nl.wms.quality_manage.service.inspection.dao.mapper.QlTestInspectionschemedtlproductstandardMapper;
import org.nl.wms.quality_manage.service.inspection.IQlTestInspectionschemedtlproductstandardService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.quality_manage.service.inspection.dto.StandardQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* <p>
* 产品检验方案标准表 服务实现类
@@ -17,4 +38,63 @@ import org.springframework.stereotype.Service;
@Service
public class QlTestInspectionschemedtlproductstandardServiceImpl extends ServiceImpl<QlTestInspectionschemedtlproductstandardMapper, QlTestInspectionschemedtlproductstandard> implements IQlTestInspectionschemedtlproductstandardService {
@Autowired
private IQlTestInspectionschememstService inspectionschememstService;
@Override
public Object query(StandardQuery query, PageQuery pageQuery) {
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
TableDataInfo build = TableDataInfo.build(this.baseMapper.getDtl(query));
build.setTotalElements(page.getTotal());
return build;
}
@Override
public List<Map> getDtl(JSONObject whereJson) {
return this.baseMapper.queryDtl(whereJson);
}
@Override
public void saveData(JSONObject jo) {
//1-复制新增2-新增3-修改
String material_id = jo.getString("material_id");
JSONArray rows = jo.getJSONArray("tableData");
if (StrUtil.isEmpty(material_id)) {
throw new BadRequestException("物料不能为空!");
}
if (rows.size() == 0) {
throw new BadRequestException("明细不能为空!");
}
this.remove(new QueryWrapper<QlTestInspectionschemedtlproductstandard>().lambda().eq(QlTestInspectionschemedtlproductstandard::getMaterial_id, material_id));
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
row.put("material_id",jo.getString("material_id"));
row.put("material_code",jo.getString("material_code"));
this.save(packageMstForm(new QlTestInspectionschemedtlproductstandard(), row));
}
}
@NotNull
private QlTestInspectionschemedtlproductstandard packageMstForm(QlTestInspectionschemedtlproductstandard mst, JSONObject whereJson) {
mst.setInspection_standard_dtl_id(IdUtil.getStringId());
mst.setMaterial_id(whereJson.getString("material_id"));
mst.setMaterial_code(whereJson.getString("material_code"));
String inspection_scheme_id = whereJson.getString("inspection_scheme_id");
mst.setInspection_scheme_id(whereJson.getString("inspection_scheme_id"));
QlTestInspectionschememst scheme_mst = inspectionschememstService.getOne(new QueryWrapper<QlTestInspectionschememst>().lambda().eq(QlTestInspectionschememst::getInspection_scheme_id, inspection_scheme_id));
mst.setInspection_scheme_code(scheme_mst.getInspection_scheme_code());
mst.setInspection_scheme_name(scheme_mst.getInspection_scheme_name());
mst.setInspection_item_id(whereJson.getString("inspection_item_id"));
mst.setInspection_item_code(whereJson.getString("inspection_item_code"));
mst.setInspection_item_name(whereJson.getString("inspection_item_name"));
mst.setUp_limit(whereJson.getBigDecimal("up_limit"));
mst.setDown_limit(whereJson.getBigDecimal("down_limit"));
mst.setUp_limit_value(whereJson.getBigDecimal("up_limit_value"));
mst.setDown_limit_value(whereJson.getBigDecimal("down_limit_value"));
mst.setRemark(whereJson.getString("remark"));
return mst;
}
}

View File

@@ -1,9 +1,29 @@
package org.nl.wms.quality_manage.service.inspection.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.jsonwebtoken.lang.Assert;
import org.jetbrains.annotations.NotNull;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.wms.quality_manage.service.inspection.IQlTestInspectionschemedtlService;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionitempoint;
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
import org.nl.wms.quality_manage.service.inspection.dao.mapper.QlTestInspectionschememstMapper;
import org.nl.wms.quality_manage.service.inspection.IQlTestInspectionschememstService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.quality_manage.service.inspection.dto.ItemPointQuery;
import org.nl.wms.quality_manage.service.inspection.dto.SchemeQuery;
import org.nl.wms.storage_manage.semimanage.service.check.dao.StIvtCheckmstBcp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@@ -17,4 +37,58 @@ import org.springframework.stereotype.Service;
@Service
public class QlTestInspectionschememstServiceImpl extends ServiceImpl<QlTestInspectionschememstMapper, QlTestInspectionschememst> implements IQlTestInspectionschememstService {
@Autowired
private IQlTestInspectionschemedtlService inspectionschemedtlService;
@Override
public void update(JSONObject form) {
Assert.notNull(form.get("inspection_scheme_id"), "请求参数不能为空");
QlTestInspectionschememst mst = form.toJavaObject(QlTestInspectionschememst.class);
mst.setUpdate_optid(SecurityUtils.getCurrentUserId());
mst.setUpdate_optname(SecurityUtils.getCurrentNickName());
mst.setUpdate_time(DateUtil.now());
this.updateById(mst);
JSONArray rows = form.getJSONArray("tableData");
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
// 调用明细表 插入/更新方法
inspectionschemedtlService.create(rows, mst);
}
@Override
public Object pageQuery(SchemeQuery query, PageQuery page) {
// 分页查询
QueryWrapper<QlTestInspectionschememst> queryWrapper = new QueryWrapper<>();
Page<QlTestInspectionschememst> pageQuery = this.page(page.build(), query.build());
TableDataInfo<QlTestInspectionschememst> build = TableDataInfo.build(pageQuery);
return build;
}
@Override
public void create(JSONObject jo) {
JSONArray rows = jo.getJSONArray("tableData");
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
// 调用主表 插入/更新方法
QlTestInspectionschememst mst = packageMstForm(new QlTestInspectionschememst(), jo);
this.save(mst);
//调用明细表 插入方法
inspectionschemedtlService.create(rows, mst);
}
@NotNull
private QlTestInspectionschememst packageMstForm(QlTestInspectionschememst mst, JSONObject whereJson) {
mst.setInspection_scheme_id(IdUtil.getStringId());
mst.setInspection_scheme_code(CodeUtil.getNewCode("F_CODE"));
mst.setInspection_scheme_name(whereJson.getString("inspection_scheme_name"));
mst.setInspection_scheme_type(whereJson.getString("inspection_scheme_type"));
mst.setDetail_count(whereJson.getBigDecimal("detail_count"));
mst.setIs_used(true);
mst.setRemark(whereJson.getString("remark"));
mst.setCreate_id(SecurityUtils.getCurrentUserId());
mst.setCreate_name(SecurityUtils.getCurrentNickName());
mst.setCreate_time(DateUtil.now());
return mst;
}
}

View File

@@ -42,7 +42,7 @@ public class SysCodeRule implements Serializable {
/**
* 当前值
*/
private String currentValue;
private String current_value;
/**
* 备注
@@ -52,42 +52,42 @@ public class SysCodeRule implements Serializable {
/**
* 是否启用
*/
private String isActive;
private String is_active;
/**
* 是否删除
*/
private String isDelete;
private String is_delete;
/**
* 创建id
*/
private String createId;
private String create_id;
/**
* 创建者
*/
private String createName;
private String create_name;
/**
* 创建时间
*/
private String createTime;
private String create_time;
/**
* 修改id
*/
private String updateId;
private String update_id;
/**
* 修改者
*/
private String updateName;
private String update_name;
/**
* 修改时间
*/
private String updateTime;
private String update_time;
@TableField(exist = false)
private String demo;

View File

@@ -38,17 +38,17 @@ public class SysCodeRuleDetail implements Serializable {
/**
* 初始值
*/
private String initValue;
private String init_value;
/**
* 当前值
*/
private String currentValue;
private String current_value;
/**
* 允许最大值
*/
private String maxValue;
private String max_value;
/**
* 步长
@@ -73,7 +73,7 @@ public class SysCodeRuleDetail implements Serializable {
/**
* 排序号
*/
private BigDecimal sortNum;
private BigDecimal sort_num;
/**
* 备注
@@ -83,50 +83,50 @@ public class SysCodeRuleDetail implements Serializable {
/**
* 编码规则标识
*/
private String codeRuleId;
private String code_rule_id;
/**
* 是否启用
*/
private String isActive;
private String is_active;
/**
* 是否删除
*/
private String isDelete;
private String is_delete;
/**
* 创建id
*/
private String createId;
private String create_id;
/**
* 创建者
*/
private String createName;
private String create_name;
/**
* 创建时间
*/
private String createTime;
private String create_time;
/**
* 修改id
*/
private String updateId;
private String update_id;
/**
* 修改者
*/
private String updateName;
private String update_name;
/**
* 修改时间
*/
private String updateTime;
private String update_time;
@TableField(exist = false)
private String dictName;
private String dict_name;
}

View File

@@ -35,8 +35,8 @@ public class SysCodeRuleDetailServiceImpl extends ServiceImpl<SysCodeRuleDetailM
@Override
public IPage<SysCodeRuleDetail> queryAll(CodeRuleDetailQuery form, PageQuery page) {
LambdaQueryWrapper<SysCodeRuleDetail> lam = new LambdaQueryWrapper<>();
lam.eq(SysCodeRuleDetail::getCodeRuleId, form.getId())
.orderByAsc(SysCodeRuleDetail::getSortNum);
lam.eq(SysCodeRuleDetail::getCode_rule_id, form.getId())
.orderByAsc(SysCodeRuleDetail::getSort_num);
IPage<SysCodeRuleDetail> pages = new Page<>(page.getPage() + 1, page.getSize());
codeRuleDetailMapper.selectPage(pages, lam);
return pages;
@@ -49,19 +49,19 @@ public class SysCodeRuleDetailServiceImpl extends ServiceImpl<SysCodeRuleDetailM
String currentNickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
codeRuleDetail.setId(IdUtil.getSnowflake(1,1).nextIdStr());
codeRuleDetail.setCurrentValue(codeRuleDetail.getInitValue());
codeRuleDetail.setCreateId(currentUserId);
codeRuleDetail.setCreateName(currentNickName);
codeRuleDetail.setCreateTime(now);
codeRuleDetail.setUpdateId(currentUserId);
codeRuleDetail.setUpdateName(currentNickName);
codeRuleDetail.setUpdateTime(now);
codeRuleDetail.setCurrent_value(codeRuleDetail.getInit_value());
codeRuleDetail.setCreate_id(currentUserId);
codeRuleDetail.setCreate_name(currentNickName);
codeRuleDetail.setCreate_time(now);
codeRuleDetail.setUpdate_id(currentUserId);
codeRuleDetail.setUpdate_name(currentNickName);
codeRuleDetail.setUpdate_time(now);
if (codeRuleDetail.getType().equals(CodeRuleTypeEnum.DATE.getType())) {
Date date = DateUtil.date();
String format = codeRuleDetail.getFormat();
String nowDate = DateUtil.format(date, format);
codeRuleDetail.setInitValue(nowDate);
codeRuleDetail.setCurrentValue(nowDate);
codeRuleDetail.setInit_value(nowDate);
codeRuleDetail.setCurrent_value(nowDate);
}
codeRuleDetailMapper.insert(codeRuleDetail);
}

View File

@@ -55,7 +55,7 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
String id = codeRuleMapper.selectOne(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, code)).getId();
// 如果flag = 1就执行更新数据库的操作
String flag = (String) form.get("flag");
List<SysCodeRuleDetail> ruleDetails = codeRuleDetailMapper.selectList(new LambdaQueryWrapper<SysCodeRuleDetail>().eq(SysCodeRuleDetail::getCodeRuleId, id));
List<SysCodeRuleDetail> ruleDetails = codeRuleDetailMapper.selectList(new LambdaQueryWrapper<SysCodeRuleDetail>().eq(SysCodeRuleDetail::getCode_rule_id, id));
String demo = "";
boolean isSame = true;
for(SysCodeRuleDetail detail : ruleDetails) {
@@ -63,11 +63,11 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
String type = detail.getType();
//固定直接取值
if (type.equals(CodeRuleTypeEnum.FIXED.getType())) {
value = detail.getInitValue();
value = detail.getInit_value();
}
//日期判断数据库的值与当前值是否相同来决定顺序的值
if (type.equals(CodeRuleTypeEnum.DATE.getType())) {
String currentValue = detail.getCurrentValue();
String currentValue = detail.getCurrent_value();
Date date = DateUtil.date();
String format = detail.getFormat();
String nowDate = DateUtil.format(date, format);
@@ -75,8 +75,8 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
isSame = false;
}
if (flag.equals("1")) {
detail.setInitValue(nowDate);
detail.setCurrentValue(nowDate);
detail.setInit_value(nowDate);
detail.setCurrent_value(nowDate);
}
value = nowDate;
}
@@ -84,11 +84,11 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
if (type.equals(CodeRuleTypeEnum.ORDER.getType())) {
String numValue = "";
int step = Integer.parseInt(detail.getStep());
Long maxValue = Long.valueOf(detail.getMaxValue());
if (!isSame && (Long.valueOf(detail.getCurrentValue()) + step) > maxValue) {
numValue = detail.getInitValue();
Long maxValue = Long.valueOf(detail.getMax_value());
if (!isSame && (Long.parseLong(detail.getCurrent_value()) + step) > maxValue) {
numValue = detail.getInit_value();
} else {
numValue = Integer.parseInt(detail.getCurrentValue()) + step + "";
numValue = Integer.parseInt(detail.getCurrent_value()) + step + "";
}
int size = numValue.length();
int length = detail.getLength();
@@ -99,18 +99,18 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
value += numValue;
if (flag.equals("1")) {
if (!isSame) {
int initValue = Integer.parseInt(detail.getInitValue());
int initValue = Integer.parseInt(detail.getInit_value());
if (StrUtil.isEmpty((initValue + ""))) {
throw new BadRequestException("请完善编码数值的初始值!");
}
detail.setCurrentValue(String.valueOf(initValue));
detail.setCurrent_value(String.valueOf(initValue));
} else {
int numCurr = Integer.parseInt(detail.getCurrentValue());
int numCurr = Integer.parseInt(detail.getCurrent_value());
if (numCurr >= maxValue) {
numCurr = Integer.parseInt(detail.getInitValue());
detail.setCurrentValue(String.valueOf(numCurr));
numCurr = Integer.parseInt(detail.getInit_value());
detail.setCurrent_value(String.valueOf(numCurr));
}else{
detail.setCurrentValue(String.valueOf(numCurr + step));
detail.setCurrent_value(String.valueOf(numCurr + step));
}
}
}
@@ -132,12 +132,12 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
List<SysCodeRule> sysCodeRules = codeRuleMapper.selectList(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, codeRule.getCode()));
if (ObjectUtil.isNotEmpty(sysCodeRules)) throw new BadRequestException("编号[" + sysCodeRules.get(0).getCode() + "]已存在");
codeRule.setId(IdUtil.getSnowflake(1,1).nextIdStr());
codeRule.setCreateId(currentUserId);
codeRule.setCreateName(currentUsername);
codeRule.setCreateTime(now);
codeRule.setUpdateId(currentUserId);
codeRule.setUpdateName(currentUsername);
codeRule.setUpdateTime(now);
codeRule.setCreate_id(currentUserId);
codeRule.setCreate_name(currentUsername);
codeRule.setCreate_time(now);
codeRule.setUpdate_id(currentUserId);
codeRule.setUpdate_name(currentUsername);
codeRule.setUpdate_time(now);
codeRuleMapper.insert(codeRule);
}
@@ -146,7 +146,7 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
public void deleteCodeRule(Set<String> ids) {
ids.forEach(id -> {
codeRuleMapper.deleteById(id);
codeRuleDetailMapper.delete(new LambdaQueryWrapper<SysCodeRuleDetail>().eq(SysCodeRuleDetail::getCodeRuleId, id));
codeRuleDetailMapper.delete(new LambdaQueryWrapper<SysCodeRuleDetail>().eq(SysCodeRuleDetail::getCode_rule_id, id));
});
}
@@ -159,9 +159,9 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
String currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
codeRule.setUpdateId(currentUserId);
codeRule.setUpdateName(currentUsername);
codeRule.setUpdateTime(now);
codeRule.setUpdate_id(currentUserId);
codeRule.setUpdate_name(currentUsername);
codeRule.setUpdate_time(now);
codeRuleMapper.updateById(codeRule);
}