成型机产量查询报表

master
陈恒杰 5 months ago
parent fbfcf2a290
commit be0e664a90

@ -0,0 +1,105 @@
package com.op.mes.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.common.security.annotation.RequiresPermissions;
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.op.common.log.annotation.Log;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.log.enums.BusinessType;
import com.op.mes.domain.MesCxjProducted;
import com.op.mes.service.IMesCxjProductedService;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-03-20
*/
@RestController
@RequestMapping("/producted")
public class MesCxjProductedController extends BaseController
{
@Autowired
private IMesCxjProductedService mesCxjProductedService;
/**
*
*/
// @RequiresPermissions("@ss.hasPermi('system:producted:list')")
@GetMapping("/list")
public TableDataInfo list(MesCxjProducted mesCxjProducted)
{
startPage();
List<MesCxjProducted> list = mesCxjProductedService.selectMesCxjProductedList(mesCxjProducted);
return getDataTable(list);
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('system:producted:export')")
@Log(title = "成型机产量", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesCxjProducted mesCxjProducted)
{
List<MesCxjProducted> list = mesCxjProductedService.selectMesCxjProductedList(mesCxjProducted);
ExcelUtil<MesCxjProducted> util = new ExcelUtil<MesCxjProducted>(MesCxjProducted.class);
util.exportExcel(response, list, "成型机产量数据");
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('system:producted:query')")
@GetMapping(value = "/{workorderCode}")
public AjaxResult getInfo(@PathVariable("workorderCode") String workorderCode)
{
return success(mesCxjProductedService.selectMesCxjProductedByWorkorderCode(workorderCode));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('system:producted:add')")
@Log(title = "成型机产量", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesCxjProducted mesCxjProducted)
{
return toAjax(mesCxjProductedService.insertMesCxjProducted(mesCxjProducted));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('system:producted:edit')")
@Log(title = "成型机产量", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesCxjProducted mesCxjProducted)
{
return toAjax(mesCxjProductedService.updateMesCxjProducted(mesCxjProducted));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('system:producted:remove')")
@Log(title = "成型机产量", businessType = BusinessType.DELETE)
@DeleteMapping("/{workorderCodes}")
public AjaxResult remove(@PathVariable String[] workorderCodes)
{
return toAjax(mesCxjProductedService.deleteMesCxjProductedByWorkorderCodes(workorderCodes));
}
}

@ -0,0 +1,136 @@
package com.op.mes.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* mes_cxj_producted
*
* @author chj
* @date 2025-03-20
*/
public class MesCxjProducted extends BaseEntity
{
private static final long serialVersionUID = 1L;
/**
*
*/
private String productCode;
/*
*/
private String productName;
/**
*
*/
private String ShiftId;
/** 工单号 */
@Excel(name = "工单号")
private String workorderCode;
/** 机台编码 */
@Excel(name = "机台编码")
private String workorderName;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime beginTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endTime;
public LocalDateTime getBeginTime() {
return beginTime;
}
public void setBeginTime(LocalDateTime beginTime) {
this.beginTime = beginTime;
}
public LocalDateTime getEndTime() {
return endTime;
}
public void setEndTime(LocalDateTime endTime) {
this.endTime = endTime;
}
/** 备用1 */
@Excel(name = "备用1")
private String attr1;
/** 备用2 */
@Excel(name = "备用2")
private String attr2;
/** 备用2 */
@Excel(name = "备用2")
private String attr3;
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getShiftId() {
return ShiftId;
}
public void setShiftId(String shiftId) {
ShiftId = shiftId;
}
public String getWorkorderCode() {
return workorderCode;
}
public void setWorkorderCode(String workorderCode) {
this.workorderCode = workorderCode;
}
public String getWorkorderName() {
return workorderName;
}
public void setWorkorderName(String workorderName) {
this.workorderName = workorderName;
}
@Override
public String toString() {
return "MesCxjProducted{" +
"productCode='" + productCode + '\'' +
", productName='" + productName + '\'' +
", ShiftId='" + ShiftId + '\'' +
", workorderCode='" + workorderCode + '\'' +
", workorderName='" + workorderName + '\'' +
", beginTime='" + beginTime + '\'' +
", endTime='" + endTime + '\'' +
", attr1='" + attr1 + '\'' +
", attr2='" + attr2 + '\'' +
", attr3='" + attr3 + '\'' +
'}';
}
}

@ -0,0 +1,61 @@
package com.op.mes.mapper;
import java.util.List;
import com.op.mes.domain.MesCxjProducted;
/**
* Mapper
*
* @author ruoyi
* @date 2025-03-20
*/
public interface MesCxjProductedMapper
{
/**
*
*
* @param workorderCode
* @return
*/
public MesCxjProducted selectMesCxjProductedByWorkorderCode(String workorderCode);
/**
*
*
* @param mesCxjProducted
* @return
*/
public List<MesCxjProducted> selectMesCxjProductedList(MesCxjProducted mesCxjProducted);
/**
*
*
* @param mesCxjProducted
* @return
*/
public int insertMesCxjProducted(MesCxjProducted mesCxjProducted);
/**
*
*
* @param mesCxjProducted
* @return
*/
public int updateMesCxjProducted(MesCxjProducted mesCxjProducted);
/**
*
*
* @param workorderCode
* @return
*/
public int deleteMesCxjProductedByWorkorderCode(String workorderCode);
/**
*
*
* @param workorderCodes
* @return
*/
public int deleteMesCxjProductedByWorkorderCodes(String[] workorderCodes);
}

@ -0,0 +1,61 @@
package com.op.mes.service;
import java.util.List;
import com.op.mes.domain.MesCxjProducted;
/**
* Service
*
* @author ruoyi
* @date 2025-03-20
*/
public interface IMesCxjProductedService
{
/**
*
*
* @param workorderCode
* @return
*/
public MesCxjProducted selectMesCxjProductedByWorkorderCode(String workorderCode);
/**
*
*
* @param mesCxjProducted
* @return
*/
public List<MesCxjProducted> selectMesCxjProductedList(MesCxjProducted mesCxjProducted);
/**
*
*
* @param mesCxjProducted
* @return
*/
public int insertMesCxjProducted(MesCxjProducted mesCxjProducted);
/**
*
*
* @param mesCxjProducted
* @return
*/
public int updateMesCxjProducted(MesCxjProducted mesCxjProducted);
/**
*
*
* @param workorderCodes
* @return
*/
public int deleteMesCxjProductedByWorkorderCodes(String[] workorderCodes);
/**
*
*
* @param workorderCode
* @return
*/
public int deleteMesCxjProductedByWorkorderCode(String workorderCode);
}

@ -0,0 +1,103 @@
package com.op.mes.service.impl;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesCxjProductedMapper;
import com.op.mes.domain.MesCxjProducted;
import com.op.mes.service.IMesCxjProductedService;
/**
* Service
*
* @author ruoyi
* @date 2025-03-20
*/
@Service
public class MesCxjProductedServiceImpl implements IMesCxjProductedService
{
@Autowired
private MesCxjProductedMapper mesCxjProductedMapper;
/**
*
*
* @param workorderCode
* @return
*/
@Override
@DS("#header.poolName")
public MesCxjProducted selectMesCxjProductedByWorkorderCode(String workorderCode)
{
return mesCxjProductedMapper.selectMesCxjProductedByWorkorderCode(workorderCode);
}
/**
*
*
* @param mesCxjProducted
* @return
*/
@Override
@DS("#header.poolName")
public List<MesCxjProducted> selectMesCxjProductedList(MesCxjProducted mesCxjProducted)
{
return mesCxjProductedMapper.selectMesCxjProductedList(mesCxjProducted);
}
/**
*
*
* @param mesCxjProducted
* @return
*/
@Override
@DS("#header.poolName")
public int insertMesCxjProducted(MesCxjProducted mesCxjProducted)
{
mesCxjProducted.setCreateTime(DateUtils.getNowDate());
return mesCxjProductedMapper.insertMesCxjProducted(mesCxjProducted);
}
/**
*
*
* @param mesCxjProducted
* @return
*/
@Override
@DS("#header.poolName")
public int updateMesCxjProducted(MesCxjProducted mesCxjProducted)
{
return mesCxjProductedMapper.updateMesCxjProducted(mesCxjProducted);
}
/**
*
*
* @param workorderCodes
* @return
*/
@Override
@DS("#header.poolName")
public int deleteMesCxjProductedByWorkorderCodes(String[] workorderCodes)
{
return mesCxjProductedMapper.deleteMesCxjProductedByWorkorderCodes(workorderCodes);
}
/**
*
*
* @param workorderCode
* @return
*/
@Override
@DS("#header.poolName")
public int deleteMesCxjProductedByWorkorderCode(String workorderCode)
{
return mesCxjProductedMapper.deleteMesCxjProductedByWorkorderCode(workorderCode);
}
}

@ -0,0 +1,98 @@
<?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.op.mes.mapper.MesCxjProductedMapper">
<resultMap type="MesCxjProducted" id="MesCxjProductedResult">
<result property="workorderCode" column="workorder_code" />
<result property="workorderName" column="workorder_name" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="createTime" column="create_time" />
<result property="shiftId" column="shift_id" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
</resultMap>
<!-- <sql id="selectMesCxjProductedVo">-->
<!-- select workorder_code, workorder_name, create_time, attr1, attr2, attr3 from mes_cxj_producted-->
<!-- </sql>-->
<sql id="selectMesCxjProductedVo">
SELECT
pro_order_workorder.workorder_code,
pro_order_workorder.product_code,
pro_order_workorder.product_name,
mes_cxj_producted.workorder_name,
mes_cxj_producted.create_time,
pro_order_workorder.shift_id
FROM
mes_cxj_producted LEFT JOIN
pro_order_workorder on mes_cxj_producted.workorder_code = pro_order_workorder.workorder_id
</sql>
<select id="selectMesCxjProductedList" parameterType="MesCxjProducted" resultMap="MesCxjProductedResult">
<include refid="selectMesCxjProductedVo"/>
<where>
<if test="workorderCode != null and workorderCode != ''"> and workorder_code = #{workorderCode}</if>
<if test="workorderName != null and workorderName != ''"> and mes_cxj_producted.workorder_name like concat('%', #{workorderName}, '%')</if>
<if test="beginTime != null">
AND mes_cxj_producted.create_time >= #{beginTime}
</if>
<if test="endTime != null">
AND mes_cxj_producted.create_time &lt;= #{endTime}
</if>
</where>
ORDER BY mes_cxj_producted.create_time DESC
</select>
<select id="selectMesCxjProductedByWorkorderCode" parameterType="String" resultMap="MesCxjProductedResult">
<include refid="selectMesCxjProductedVo"/>
where workorder_code = #{workorderCode}
</select>
<insert id="insertMesCxjProducted" parameterType="MesCxjProducted">
insert into mes_cxj_producted
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workorderCode != null">workorder_code,</if>
<if test="workorderName != null">workorder_name,</if>
<if test="createTime != null">create_time,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workorderCode != null">#{workorderCode},</if>
<if test="workorderName != null">#{workorderName},</if>
<if test="createTime != null">#{createTime},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
</trim>
</insert>
<update id="updateMesCxjProducted" parameterType="MesCxjProducted">
update mes_cxj_producted
<trim prefix="SET" suffixOverrides=",">
<if test="workorderName != null">workorder_name = #{workorderName},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
</trim>
where workorder_code = #{workorderCode}
</update>
<delete id="deleteMesCxjProductedByWorkorderCode" parameterType="String">
delete from mes_cxj_producted where workorder_code = #{workorderCode}
</delete>
<delete id="deleteMesCxjProductedByWorkorderCodes" parameterType="String">
delete from mes_cxj_producted where workorder_code in
<foreach item="workorderCode" collection="array" open="(" separator="," close=")">
#{workorderCode}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save