rev:质检模块和原材料入库优化
This commit is contained in:
@@ -4,22 +4,17 @@
|
||||
|
||||
<select id="getMstDetail" resultType="java.util.Map">
|
||||
SELECT
|
||||
po.ask_time,
|
||||
po.po_code,
|
||||
po.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
class.class_name,
|
||||
po.total_qty,
|
||||
po.total_qty - po.instor_qty AS need_qty,
|
||||
po.qty_unit_name,
|
||||
po.qty_unit_id,
|
||||
po.material_id
|
||||
po.total_qty - po.instor_qty AS need_qty
|
||||
FROM
|
||||
pcs_if_purchaseorder po
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = po.material_id
|
||||
LEFT JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
|
||||
<where>
|
||||
po.status = '30'
|
||||
po.status IN ('30','40')
|
||||
<if test="query.start_time != null">
|
||||
and po.ask_time >= #{query.start_time}
|
||||
</if>
|
||||
|
||||
@@ -65,6 +65,7 @@ public class PcsIfPurchaseorderServiceImpl extends ServiceImpl<PcsIfPurchaseorde
|
||||
}
|
||||
|
||||
BigDecimal new_instor_qty = NumberUtil.add(instor_qty, purchaseorder.getInstor_qty(), 3);
|
||||
purchaseorder.setQty(new_instor_qty);
|
||||
if (purchaseorder.getTotal_qty().compareTo(new_instor_qty) <= 0) {
|
||||
purchaseorder.setSTATUS(PCSEnum.BILL_STATUS.code("完成"));
|
||||
purchaseorder.setConfirm_id(SecurityUtils.getCurrentUserId());
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
package org.nl.wms.quality_manage.controller.report;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.common.utils.SecurityUtils;
|
||||
import org.nl.wms.quality_manage.service.TCEnum;
|
||||
import org.nl.wms.quality_manage.service.report.IQlTestInspectionsheetdtlService;
|
||||
import org.nl.wms.quality_manage.service.report.IQlTestInspectionsheetmstService;
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetdtl;
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetmst;
|
||||
import org.nl.wms.quality_manage.service.report.dto.SheetQuery;
|
||||
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 +28,73 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @since 2023-05-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/qlTestInspectionsheetmst")
|
||||
@RequestMapping("/api/physicalMst")
|
||||
public class QlTestInspectionsheetmstController {
|
||||
|
||||
@Autowired
|
||||
private IQlTestInspectionsheetmstService inspectionsheetmstService;
|
||||
@Autowired
|
||||
private IQlTestInspectionsheetdtlService inspectionsheetdtlService;
|
||||
|
||||
@PostMapping
|
||||
@Log("新增质检单")
|
||||
@ApiOperation("新增质检单")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
|
||||
inspectionsheetmstService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@Log("修改质检单")
|
||||
@ApiOperation("修改质检单")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
inspectionsheetmstService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@Log("删除质检单")
|
||||
@ApiOperation("删除质检单")
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
inspectionsheetmstService.removeById(id);
|
||||
inspectionsheetdtlService.remove(new QueryWrapper<QlTestInspectionsheetdtl>().lambda().eq(QlTestInspectionsheetdtl::getInspection_id, id));
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询质检单")
|
||||
@ApiOperation("查询质检单")
|
||||
public ResponseEntity<Object> query(SheetQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(inspectionsheetmstService.pageQuery(query, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getResult")
|
||||
@Log("查询质检单明细")
|
||||
@ApiOperation("查询质检单明细")
|
||||
public ResponseEntity<Object> getResult(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(inspectionsheetmstService.getResult(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/saveResult")
|
||||
@Log("保存质检单明细")
|
||||
@ApiOperation("保存质检单明细")
|
||||
public ResponseEntity<Object> saveResult(@RequestBody JSONObject whereJson) {
|
||||
inspectionsheetmstService.saveResult(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("确认质检单")
|
||||
@ApiOperation("确认质检单")
|
||||
public ResponseEntity<Object> confirm(@RequestBody QlTestInspectionsheetmst mst) {
|
||||
mst.setBill_status(TCEnum.BILL_STATUS.code("完成"));
|
||||
mst.setConfirm_optid(SecurityUtils.getCurrentUserId());
|
||||
mst.setConfirm_optname(SecurityUtils.getCurrentNickName());
|
||||
mst.setConfirm_time(DateUtil.now());
|
||||
inspectionsheetmstService.updateById(mst);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.nl.wms.quality_manage.service;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/5/4 20:11
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum TCEnum {
|
||||
//出入库类型
|
||||
RESULT_TYPE(MapOf.of("合格", "1", "不合格", "2","紧急放行","3")),
|
||||
//生成方式
|
||||
CREATE_MODE(MapOf.of("PC生成", "1", "终端生成", "2","外部借口产生","3")),
|
||||
//是否
|
||||
GRADE_TYPE(MapOf.of("一级", "1", "二级", "2", "三级", "3")),
|
||||
//单据状态
|
||||
BILL_STATUS(MapOf.of("生成", "10", "提交", "20", "检测中", "30", "确认", "50", "完成", "99")),
|
||||
;
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return code;
|
||||
}
|
||||
throw new BadRequestException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public String check(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
|
||||
if (entry.getValue().equals("code")) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
throw new BadRequestException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@
|
||||
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">
|
||||
<if test="form.material_id != null">
|
||||
AND stand.material_id = #{form.material_id}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package org.nl.wms.quality_manage.service.report;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetdtl;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetmst;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +18,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IQlTestInspectionsheetdtlService extends IService<QlTestInspectionsheetdtl> {
|
||||
|
||||
int create(QlTestInspectionsheetmst mst);
|
||||
|
||||
List<Map> getResult(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
package org.nl.wms.quality_manage.service.report;
|
||||
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetmst;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
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.report.dao.QlTestInspectionsheetmst;
|
||||
import org.nl.wms.quality_manage.service.report.dto.SheetQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +20,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IQlTestInspectionsheetmstService extends IService<QlTestInspectionsheetmst> {
|
||||
|
||||
void create(JSONObject jo);
|
||||
|
||||
void update(JSONObject jo);
|
||||
|
||||
Object pageQuery(SheetQuery query, PageQuery page);
|
||||
|
||||
JSONObject getResult(JSONObject whereJson);
|
||||
void saveResult(JSONObject whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.quality_manage.service.report.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
@@ -21,15 +23,17 @@ public class QlTestInspectionsheetdtl implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 质检单明细标识
|
||||
*/
|
||||
private Long inspectiondtl_id;
|
||||
@TableId
|
||||
private String inspectiondtl_id;
|
||||
|
||||
/**
|
||||
* 质检单标识
|
||||
*/
|
||||
private Long inspection_id;
|
||||
private String inspection_id;
|
||||
|
||||
/**
|
||||
* 明细序号
|
||||
@@ -39,7 +43,7 @@ public class QlTestInspectionsheetdtl implements Serializable {
|
||||
/**
|
||||
* 项点标识
|
||||
*/
|
||||
private Long inspection_item_id;
|
||||
private String inspection_item_id;
|
||||
|
||||
/**
|
||||
* 项点值
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.quality_manage.service.report.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;
|
||||
@@ -20,12 +22,13 @@ import lombok.EqualsAndHashCode;
|
||||
@TableName("ql_test_inspectionsheetmst")
|
||||
public class QlTestInspectionsheetmst implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 质检单标识
|
||||
*/
|
||||
private Long inspection_id;
|
||||
@TableId
|
||||
private String inspection_id;
|
||||
|
||||
/**
|
||||
* 质检单编号
|
||||
@@ -45,7 +48,7 @@ public class QlTestInspectionsheetmst implements Serializable {
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private Long material_id;
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
@@ -60,7 +63,7 @@ public class QlTestInspectionsheetmst implements Serializable {
|
||||
/**
|
||||
* 数量计量单位标识
|
||||
*/
|
||||
private Long qty_unit_id;
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 数量计量单位名称
|
||||
@@ -80,7 +83,7 @@ public class QlTestInspectionsheetmst implements Serializable {
|
||||
/**
|
||||
* 来源单据标识
|
||||
*/
|
||||
private Long source_bill_id;
|
||||
private String source_bill_id;
|
||||
|
||||
/**
|
||||
* 来源单据类型
|
||||
@@ -105,7 +108,7 @@ public class QlTestInspectionsheetmst implements Serializable {
|
||||
/**
|
||||
* 基础单据标识
|
||||
*/
|
||||
private Long base_bill_id;
|
||||
private String base_bill_id;
|
||||
|
||||
/**
|
||||
* 基础单据类型
|
||||
@@ -140,7 +143,7 @@ public class QlTestInspectionsheetmst implements Serializable {
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
@@ -155,7 +158,7 @@ public class QlTestInspectionsheetmst implements Serializable {
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
@@ -170,7 +173,7 @@ public class QlTestInspectionsheetmst implements Serializable {
|
||||
/**
|
||||
* 确认人
|
||||
*/
|
||||
private Long confirm_optid;
|
||||
private String confirm_optid;
|
||||
|
||||
/**
|
||||
* 确认人姓名
|
||||
@@ -185,17 +188,17 @@ public class QlTestInspectionsheetmst implements Serializable {
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long sysdeptid;
|
||||
private String sysdeptid;
|
||||
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
private Long syscompanyid;
|
||||
private String syscompanyid;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
private Boolean is_delete;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@@ -205,7 +208,7 @@ public class QlTestInspectionsheetmst implements Serializable {
|
||||
/**
|
||||
* 车间标识
|
||||
*/
|
||||
private Long workshop_id;
|
||||
private String workshop_id;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@ package org.nl.wms.quality_manage.service.report.dao.mapper;
|
||||
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetdtl;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +17,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface QlTestInspectionsheetdtlMapper extends BaseMapper<QlTestInspectionsheetdtl> {
|
||||
|
||||
List<Map> getResult(@Param("id") String id);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,21 @@
|
||||
<!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.report.dao.mapper.QlTestInspectionsheetdtlMapper">
|
||||
|
||||
<select id="getResult" resultType="java.util.Map">
|
||||
SELECT
|
||||
dtl.* ,
|
||||
item.inspection_type,
|
||||
item.inspection_item_type,
|
||||
item.inspection_item_code,
|
||||
item.inspection_item_name,
|
||||
stand.up_limit,
|
||||
stand.down_limit
|
||||
FROM
|
||||
ql_test_inspectionsheetdtl dtl
|
||||
LEFT JOIN ql_test_inspectionsheetmst mst ON mst.inspection_id = dtl.inspection_id
|
||||
LEFT JOIN ql_test_inspectionschemedtlproductstandard stand ON stand.material_id = mst.material_id AND dtl.inspection_item_id = stand.inspection_item_id
|
||||
LEFT JOIN ql_test_inspectionitempoint item ON item.inspection_item_id = stand.inspection_item_id
|
||||
WHERE
|
||||
dtl.inspection_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package org.nl.wms.quality_manage.service.report.dao.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.quality_manage.service.inspection.dto.StandardQuery;
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetmst;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.quality_manage.service.report.dto.SheetQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +19,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface QlTestInspectionsheetmstMapper extends BaseMapper<QlTestInspectionsheetmst> {
|
||||
|
||||
List<Map> pageQuery(@Param("query") SheetQuery query);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,28 @@
|
||||
<!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.report.dao.mapper.QlTestInspectionsheetmstMapper">
|
||||
|
||||
<select id="pageQuery" resultType="java.util.Map">
|
||||
select
|
||||
mst.*,
|
||||
mb.material_code,
|
||||
mb.material_name
|
||||
from
|
||||
ql_test_inspectionsheetmst mst
|
||||
left join md_me_materialbase mb ON mb.material_id = mst.material_id
|
||||
<where>
|
||||
<if test="query.bill_code != null and query.bill_code != ''">
|
||||
and mst.inspection_code like '%${query.bill_code}%'
|
||||
</if>
|
||||
<if test="query.source_bill_code != null and query.source_bill_code != ''">
|
||||
and mst.source_bill_code like '%${query.source_bill_code}%'
|
||||
</if>
|
||||
<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.bill_status != null and query.bill_status != ''">
|
||||
and mst.bill_status = #{query.bill_status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.nl.wms.quality_manage.service.report.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.QlTestInspectionschememst;
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetmst;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/5/4 19:49
|
||||
*/
|
||||
@Data
|
||||
public class SheetQuery extends BaseQuery<QlTestInspectionsheetmst> {
|
||||
|
||||
private String bill_code;
|
||||
|
||||
private String source_bill_code;
|
||||
|
||||
private String material_search;
|
||||
|
||||
private String bill_status;
|
||||
|
||||
private String workshop_id;
|
||||
|
||||
}
|
||||
@@ -1,20 +1 @@
|
||||
package org.nl.wms.quality_manage.service.report.impl;
|
||||
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetdtl;
|
||||
import org.nl.wms.quality_manage.service.report.dao.mapper.QlTestInspectionsheetdtlMapper;
|
||||
import org.nl.wms.quality_manage.service.report.IQlTestInspectionsheetdtlService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 质检单明细表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-06
|
||||
*/
|
||||
@Service
|
||||
public class QlTestInspectionsheetdtlServiceImpl extends ServiceImpl<QlTestInspectionsheetdtlMapper, QlTestInspectionsheetdtl> implements IQlTestInspectionsheetdtlService {
|
||||
|
||||
}
|
||||
package org.nl.wms.quality_manage.service.report.impl;
|
||||
@@ -1,11 +1,38 @@
|
||||
package org.nl.wms.quality_manage.service.report.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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 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.service.material.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.quality_manage.service.TCEnum;
|
||||
import org.nl.wms.quality_manage.service.inspection.dao.QlTestInspectionschememst;
|
||||
import org.nl.wms.quality_manage.service.report.IQlTestInspectionsheetdtlService;
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetdtl;
|
||||
import org.nl.wms.quality_manage.service.report.dao.QlTestInspectionsheetmst;
|
||||
import org.nl.wms.quality_manage.service.report.dao.mapper.QlTestInspectionsheetmstMapper;
|
||||
import org.nl.wms.quality_manage.service.report.IQlTestInspectionsheetmstService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.quality_manage.service.report.dto.SheetQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 质检单主表 服务实现类
|
||||
@@ -17,4 +44,92 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class QlTestInspectionsheetmstServiceImpl extends ServiceImpl<QlTestInspectionsheetmstMapper, QlTestInspectionsheetmst> implements IQlTestInspectionsheetmstService {
|
||||
|
||||
@Autowired
|
||||
private IQlTestInspectionsheetdtlService inspectionsheetdtlService;
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService meMaterialbaseService;
|
||||
|
||||
@Override
|
||||
public void create(JSONObject jo) {
|
||||
// 调用主表 插入/更新方法
|
||||
QlTestInspectionsheetmst mst = packageMstForm(new QlTestInspectionsheetmst(), jo);
|
||||
this.save(mst);
|
||||
|
||||
//调用明细表 插入方法
|
||||
inspectionsheetdtlService.create(mst);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(JSONObject form) {
|
||||
Assert.notNull(form.get("inspection_id"), "请求参数不能为空");
|
||||
QlTestInspectionsheetmst mst = form.toJavaObject(QlTestInspectionsheetmst.class);
|
||||
mst.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
mst.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
mst.setUpdate_time(DateUtil.now());
|
||||
this.updateById(mst);
|
||||
|
||||
//调用明细表 插入方法
|
||||
inspectionsheetdtlService.create(mst);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object pageQuery(SheetQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
TableDataInfo build = TableDataInfo.build(this.baseMapper.pageQuery(query));
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private QlTestInspectionsheetmst packageMstForm(QlTestInspectionsheetmst mst, JSONObject whereJson) {
|
||||
mst.setInspection_id(IdUtil.getStringId());
|
||||
mst.setInspection_code(CodeUtil.getNewCode("QL_TEST_SHEET_CODE"));
|
||||
mst.setInspection_type(whereJson.getString("inspection_type"));
|
||||
mst.setBiz_date(DateUtil.today());
|
||||
mst.setMaterial_id(whereJson.getString("material_id"));
|
||||
mst.setPcsn(DateUtil.today());
|
||||
mst.setQty_unit_id(whereJson.getString("qty_unit_id"));
|
||||
mst.setQty_unit_name(whereJson.getString("qty_unit_name"));
|
||||
mst.setSource_bill_id(whereJson.getString("source_bill_id"));
|
||||
mst.setSource_bill_code(whereJson.getString("source_bill_code"));
|
||||
mst.setBill_status(TCEnum.BILL_STATUS.code("生成"));
|
||||
mst.setRemark(whereJson.getString("remark"));
|
||||
mst.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
mst.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
mst.setCreate_time(DateUtil.now());
|
||||
mst.setIs_delete(false);
|
||||
mst.setSysdeptid("111");
|
||||
mst.setSyscompanyid("111");
|
||||
return mst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveResult(JSONObject whereJson) {
|
||||
QlTestInspectionsheetmst mst = whereJson.toJavaObject(QlTestInspectionsheetmst.class);
|
||||
mst.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
mst.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
mst.setUpdate_time(DateUtil.now());
|
||||
mst.setBill_status(TCEnum.BILL_STATUS.code("确认"));
|
||||
this.updateById(mst);
|
||||
JSONArray rows = whereJson.getJSONArray("tableData");
|
||||
for (int i = 0; i <rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
QlTestInspectionsheetdtl dtl = row.toJavaObject(QlTestInspectionsheetdtl.class);
|
||||
inspectionsheetdtlService.updateById(dtl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getResult(JSONObject whereJson) {
|
||||
String inspection_id = whereJson.getString("inspection_id");
|
||||
QlTestInspectionsheetmst mst = this.getOne(new QueryWrapper<QlTestInspectionsheetmst>().eq("inspection_id", inspection_id));
|
||||
MdMeMaterialbase mater_jo = meMaterialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_id", mst.getMaterial_id()));
|
||||
JSONObject jo = JSONObject.parseObject(JSONObject.toJSONString(mst));
|
||||
jo.put("material_id", mater_jo.getMaterial_id());
|
||||
jo.put("material_code", mater_jo.getMaterial_code());
|
||||
jo.put("material_name", mater_jo.getMaterial_name());
|
||||
List<Map> result = inspectionsheetdtlService.getResult(whereJson);
|
||||
jo.put("tableData", result);
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public enum IOSEnum {
|
||||
//托盘超限类型
|
||||
VEHICLE_OVER_TYPE(MapOf.of("标准", "00", "横向超", "01","纵向超","02")),
|
||||
//单据类型
|
||||
BILL_TYPE(MapOf.of("生产入库", "11", "手工入库", "12", "原料入库", "13"
|
||||
BILL_TYPE(MapOf.of("采购入库", "11", "还回入库", "12", "手工入库", "13"
|
||||
, "领料出库", "21", "销售出库", "22", "手工出库", "23")),
|
||||
//单据状态
|
||||
BILL_STATUS(MapOf.of("生成", "10", "分配中", "20", "分配完", "30", "完成", "99")),
|
||||
|
||||
@@ -56,5 +56,12 @@ public class StIvtStructivtYlController {
|
||||
public ResponseEntity<Object> getSemiProductIvt(StructIvtYLQuery query) {
|
||||
return new ResponseEntity<>(structivtYlService.getSemiProductIvt(query), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getAllRawIvt")
|
||||
@Log("查询原料库存")
|
||||
@ApiOperation("查询原料库存")
|
||||
public ResponseEntity<Object> getAllRawIvt(StructIvtYLQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(structivtYlService.getAllRawIvt(query, page), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ public interface IStIvtStructivtYlService extends IService<StIvtStructivtYl> {
|
||||
* @return JSONObject
|
||||
*/
|
||||
Object getRawIvt(StructIvtYLQuery query, PageQuery page);
|
||||
Object getAllRawIvt(StructIvtYLQuery query, PageQuery page);
|
||||
|
||||
List<Map> getStructIvt(StructIvtYLQuery query);
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ public interface StIvtStructivtYlMapper extends BaseMapper<StIvtStructivtYl> {
|
||||
|
||||
List<Map> getRawIvt(@Param("query") StructIvtYLQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
|
||||
List<Map> getAllRawIvt(@Param("query") StructIvtYLQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
|
||||
List<Map> getProductIvt(@Param("query") StructIvtYLQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
|
||||
List<Map> getSemiProductIvt(@Param("query") StructIvtYLQuery query);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
AND
|
||||
sa.lock_type = '0'
|
||||
<if test="query.material_search != null and query.material_search != ''">
|
||||
and (mb.material_code = #{query.material_search} OR mb.material_name = #{query.material_search})
|
||||
and (mb.material_code like '%${query.material_search}%' OR mb.material_name like '%${query.material_search}%')
|
||||
</if>
|
||||
<if test="query.sect_id != null and query.sect_id != ''">
|
||||
and sa.sect_id = #{query.sect_id}
|
||||
@@ -37,6 +37,39 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getAllRawIvt" resultType="java.util.Map">
|
||||
SELECT
|
||||
ivt.*,
|
||||
mu.unit_name AS qty_unit_name,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
sa.sect_id,
|
||||
sa.sect_code,
|
||||
sa.sect_name,
|
||||
sa.struct_id,
|
||||
sa.struct_code,
|
||||
sa.struct_name,
|
||||
sa.stor_name,
|
||||
class.class_name
|
||||
FROM
|
||||
st_ivt_structivt_yl ivt
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt.material_id
|
||||
LEFT JOIN st_ivt_structattr sa ON sa.struct_id = ivt.struct_id
|
||||
LEFT JOIN md_pb_measureunit mu ON mu.measure_unit_id = ivt.qty_unit_id
|
||||
LEFT JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
|
||||
<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.struct_search != null and query.struct_search != ''">
|
||||
and (sa.struct_code like '%${query.struct_search}%' OR sa.struct_name like '%${query.struct_search}%')
|
||||
</if>
|
||||
<if test="query.struct_id != null and query.struct_id != ''">
|
||||
and sa.stor_id = #{query.stor_id}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getProductIvt" resultType="java.util.Map">
|
||||
SELECT
|
||||
ivt.*,
|
||||
|
||||
@@ -20,6 +20,10 @@ public class StructIvtYLQuery extends BaseQuery<StIvtStructivtYl> {
|
||||
|
||||
private String material_search;
|
||||
|
||||
private String stor_id;
|
||||
|
||||
private String struct_search;
|
||||
|
||||
private Boolean is_delete = false;
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,14 @@ public class StIvtStructivtYlServiceImpl extends ServiceImpl<StIvtStructivtYlMap
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
@Override
|
||||
public Object getAllRawIvt(StructIvtYLQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
List<Map> mst_detail = this.baseMapper.getAllRawIvt(query, pageQuery);
|
||||
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getStructIvt(StructIvtYLQuery query) {
|
||||
|
||||
@@ -24,9 +24,10 @@ spring:
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_one_mes_xc}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:zjhl_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:123456}
|
||||
password: ${DB_PWD:Root.123456}
|
||||
# password: ${DB_PWD:root}
|
||||
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
||||
@@ -118,7 +118,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--开发环境:打印控制台-->
|
||||
<springProfile name="dev">
|
||||
<root level="info">
|
||||
<root level="debug">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="esLogAppender"/>
|
||||
</root>
|
||||
|
||||
Reference in New Issue
Block a user