change - 成品下线异常记录报表

master
yinq 7 months ago
parent 355801cbd7
commit d3f66e9127

@ -0,0 +1,99 @@
package com.aucma.report.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.aucma.common.utils.DateUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.aucma.common.annotation.Log;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.enums.BusinessType;
import com.aucma.report.domain.RecordException;
import com.aucma.report.service.IRecordExceptionService;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.common.core.page.TableDataInfo;
/**
* 线Controller
*
* @author Yinq
* @date 2024-04-01
*/
@RestController
@RequestMapping("/report/recordException")
public class RecordExceptionController extends BaseController {
@Autowired
private IRecordExceptionService recordExceptionService;
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('report:recordException:list')")
@GetMapping("/list")
public TableDataInfo list(RecordException recordException) {
startPage();
List<RecordException> list = recordExceptionService.selectRecordExceptionList(recordException);
return getDataTable(list);
}
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('report:recordException:export')")
@Log(title = "成品下线异常记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RecordException recordException) {
List<RecordException> list = recordExceptionService.selectRecordExceptionList(recordException);
ExcelUtil<RecordException> util = new ExcelUtil<RecordException>(RecordException.class);
util.exportExcel(response, list, "成品下线异常记录数据");
}
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('report:recordException:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
return success(recordExceptionService.selectRecordExceptionByObjId(objId));
}
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('report:recordException:add')")
@Log(title = "成品下线异常记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RecordException recordException) {
return toAjax(recordExceptionService.insertRecordException(recordException));
}
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('report:recordException:edit')")
@Log(title = "成品下线异常记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RecordException recordException) {
return toAjax(recordExceptionService.updateRecordException(recordException));
}
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('report:recordException:remove')")
@Log(title = "成品下线异常记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(recordExceptionService.deleteRecordExceptionByObjIds(objIds));
}
}

@ -0,0 +1,130 @@
package com.aucma.report.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.BaseEntity;
/**
* 线 record_exception
*
* @author Yinq
* @date 2024-04-01
*/
public class RecordException extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
*
*/
@Excel(name = "产品条码")
private String productSncode;
/**
*
*/
@Excel(name = "异常信息")
private String exceptionMsg;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "扫描时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date productScantime;
/**
* 线
*/
@Excel(name = "产线编号")
private String productLineCode;
/**
* 1=69;2=;3=;4=
*/
@Excel(name = "异常类型", readConverterExp = "1==69码校验;2=重复扫描;3=未绑条码;4=未终检")
private Long exceptionType;
/**
* MES
*/
@Excel(name = "MES条码")
private String boxCode;
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setProductSncode(String productSncode) {
this.productSncode = productSncode;
}
public String getProductSncode() {
return productSncode;
}
public void setExceptionMsg(String exceptionMsg) {
this.exceptionMsg = exceptionMsg;
}
public String getExceptionMsg() {
return exceptionMsg;
}
public void setProductScantime(Date productScantime) {
this.productScantime = productScantime;
}
public Date getProductScantime() {
return productScantime;
}
public void setProductLineCode(String productLineCode) {
this.productLineCode = productLineCode;
}
public String getProductLineCode() {
return productLineCode;
}
public void setExceptionType(Long exceptionType) {
this.exceptionType = exceptionType;
}
public Long getExceptionType() {
return exceptionType;
}
public void setBoxCode(String boxCode) {
this.boxCode = boxCode;
}
public String getBoxCode() {
return boxCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("productSncode", getProductSncode())
.append("exceptionMsg", getExceptionMsg())
.append("productScantime", getProductScantime())
.append("productLineCode", getProductLineCode())
.append("exceptionType", getExceptionType())
.append("boxCode", getBoxCode())
.toString();
}
}

@ -0,0 +1,61 @@
package com.aucma.report.mapper;
import java.util.List;
import com.aucma.report.domain.RecordException;
/**
* 线Mapper
*
* @author Yinq
* @date 2024-04-01
*/
public interface RecordExceptionMapper
{
/**
* 线
*
* @param objId 线
* @return 线
*/
public RecordException selectRecordExceptionByObjId(Long objId);
/**
* 线
*
* @param recordException 线
* @return 线
*/
public List<RecordException> selectRecordExceptionList(RecordException recordException);
/**
* 线
*
* @param recordException 线
* @return
*/
public int insertRecordException(RecordException recordException);
/**
* 线
*
* @param recordException 线
* @return
*/
public int updateRecordException(RecordException recordException);
/**
* 线
*
* @param objId 线
* @return
*/
public int deleteRecordExceptionByObjId(Long objId);
/**
* 线
*
* @param objIds
* @return
*/
public int deleteRecordExceptionByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.aucma.report.service;
import java.util.List;
import com.aucma.report.domain.RecordException;
/**
* 线Service
*
* @author Yinq
* @date 2024-04-01
*/
public interface IRecordExceptionService
{
/**
* 线
*
* @param objId 线
* @return 线
*/
public RecordException selectRecordExceptionByObjId(Long objId);
/**
* 线
*
* @param recordException 线
* @return 线
*/
public List<RecordException> selectRecordExceptionList(RecordException recordException);
/**
* 线
*
* @param recordException 线
* @return
*/
public int insertRecordException(RecordException recordException);
/**
* 线
*
* @param recordException 线
* @return
*/
public int updateRecordException(RecordException recordException);
/**
* 线
*
* @param objIds 线
* @return
*/
public int deleteRecordExceptionByObjIds(Long[] objIds);
/**
* 线
*
* @param objId 线
* @return
*/
public int deleteRecordExceptionByObjId(Long objId);
}

@ -0,0 +1,87 @@
package com.aucma.report.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aucma.report.mapper.RecordExceptionMapper;
import com.aucma.report.domain.RecordException;
import com.aucma.report.service.IRecordExceptionService;
/**
* 线Service
*
* @author Yinq
* @date 2024-04-01
*/
@Service
public class RecordExceptionServiceImpl implements IRecordExceptionService {
@Autowired
private RecordExceptionMapper recordExceptionMapper;
/**
* 线
*
* @param objId 线
* @return 线
*/
@Override
public RecordException selectRecordExceptionByObjId(Long objId) {
return recordExceptionMapper.selectRecordExceptionByObjId(objId);
}
/**
* 线
*
* @param recordException 线
* @return 线
*/
@Override
public List<RecordException> selectRecordExceptionList(RecordException recordException) {
return recordExceptionMapper.selectRecordExceptionList(recordException);
}
/**
* 线
*
* @param recordException 线
* @return
*/
@Override
public int insertRecordException(RecordException recordException) {
return recordExceptionMapper.insertRecordException(recordException);
}
/**
* 线
*
* @param recordException 线
* @return
*/
@Override
public int updateRecordException(RecordException recordException) {
return recordExceptionMapper.updateRecordException(recordException);
}
/**
* 线
*
* @param objIds 线
* @return
*/
@Override
public int deleteRecordExceptionByObjIds(Long[] objIds) {
return recordExceptionMapper.deleteRecordExceptionByObjIds(objIds);
}
/**
* 线
*
* @param objId 线
* @return
*/
@Override
public int deleteRecordExceptionByObjId(Long objId) {
return recordExceptionMapper.deleteRecordExceptionByObjId(objId);
}
}

@ -0,0 +1,101 @@
<?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="com.aucma.report.mapper.RecordExceptionMapper">
<resultMap type="RecordException" id="RecordExceptionResult">
<result property="objId" column="obj_id"/>
<result property="productSncode" column="product_sncode"/>
<result property="exceptionMsg" column="exception_msg"/>
<result property="productScantime" column="product_scantime"/>
<result property="productLineCode" column="product_line_code"/>
<result property="exceptionType" column="exception_type"/>
<result property="boxCode" column="box_code"/>
</resultMap>
<sql id="selectRecordExceptionVo">
select re.obj_id,
re.product_sncode,
re.exception_msg,
re.product_scantime,
re.product_line_code,
re.exception_type,
cb.box_code
from C##AUCMA_SCADA.record_exception re
left join C##AUCMA_SCADA.CODE_BINDING cb on cb.PRODUCT_CODE = re.product_sncode
</sql>
<select id="selectRecordExceptionList" parameterType="RecordException" resultMap="RecordExceptionResult">
<include refid="selectRecordExceptionVo"/>
<where>
<if test="productSncode != null and productSncode != ''">and re.product_sncode = #{productSncode}</if>
<if test="exceptionMsg != null and exceptionMsg != ''">and re.exception_msg = #{exceptionMsg}</if>
<if test="params.beginProductScantime != null and params.beginProductScantime != '' and params.endProductScantime != null and params.endProductScantime != ''">
and re.product_scantime between to_date(#{params.beginProductScantime}, 'yyyy-mm-dd hh24:mi:ss') and
to_date(#{params.endProductScantime}, 'yyyy-mm-dd hh24:mi:ss')
</if>
<if test="productLineCode != null and productLineCode != ''">and re.product_line_code = #{productLineCode}
</if>
<if test="boxCode != null and boxCode != ''">and cb.box_code = #{boxCode}</if>
<if test="exceptionType != null ">and re.exception_type = #{exceptionType}</if>
</where>
order by re.product_scantime desc
</select>
<select id="selectRecordExceptionByObjId" parameterType="Long" resultMap="RecordExceptionResult">
<include refid="selectRecordExceptionVo"/>
where re.obj_id = #{objId}
</select>
<insert id="insertRecordException" parameterType="RecordException">
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
SELECT seq_record_exception.NEXTVAL as objId FROM DUAL
</selectKey>
insert into record_exception
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objId != null">obj_id,</if>
<if test="productSncode != null">product_sncode,</if>
<if test="exceptionMsg != null">exception_msg,</if>
<if test="productScantime != null">product_scantime,</if>
<if test="productLineCode != null">product_line_code,</if>
<if test="exceptionType != null">exception_type,</if>
<if test="boxCode != null">box_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if>
<if test="productSncode != null">#{productSncode},</if>
<if test="exceptionMsg != null">#{exceptionMsg},</if>
<if test="productScantime != null">#{productScantime},</if>
<if test="productLineCode != null">#{productLineCode},</if>
<if test="exceptionType != null">#{exceptionType},</if>
<if test="boxCode != null">#{boxCode},</if>
</trim>
</insert>
<update id="updateRecordException" parameterType="RecordException">
update record_exception
<trim prefix="SET" suffixOverrides=",">
<if test="productSncode != null">product_sncode = #{productSncode},</if>
<if test="exceptionMsg != null">exception_msg = #{exceptionMsg},</if>
<if test="productScantime != null">product_scantime = #{productScantime},</if>
<if test="productLineCode != null">product_line_code = #{productLineCode},</if>
<if test="exceptionType != null">exception_type = #{exceptionType},</if>
<if test="boxCode != null">box_code = #{boxCode},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteRecordExceptionByObjId" parameterType="Long">
delete
from record_exception
where obj_id = #{objId}
</delete>
<delete id="deleteRecordExceptionByObjIds" parameterType="String">
delete from record_exception where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -91,6 +91,7 @@
<if test="updatedBy != null and updatedBy != ''">and updated_by = #{updatedBy}</if>
<if test="updatedTime != null ">and updated_time = #{updatedTime}</if>
</where>
order by rqm.created_time desc
</select>
<select id="selectRecordQualityMaterialByObjId" parameterType="Long" resultMap="RecordQualityMaterialResult">

Loading…
Cancel
Save