admin
2024-10-15 762a5996ca5c106ca6c7665b985d56c5bc4df561
物料批次信息录入功能
已添加8个文件
992 ■■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/bs/batchInfo/controller/BsBatchInfoController.java 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/batchInfo/domain/BsBatchInfo.java 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/batchInfo/mapper/BsBatchInfoMapper.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/batchInfo/service/IBsBatchInfoService.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/batchInfo/service/impl/BsBatchInfoServiceImpl.java 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/resources/mapper/bs/batchInfo/BsBatchInfoMapper.xml 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/api/main/bs/batchInfo/batchInfo.js 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/bs/batchInfo/index.vue 324 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/batchInfo/controller/BsBatchInfoController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,110 @@
package com.jcdm.main.bs.batchInfo.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.jcdm.common.annotation.Log;
import com.jcdm.common.core.controller.BaseController;
import com.jcdm.common.core.domain.AjaxResult;
import com.jcdm.common.enums.BusinessType;
import com.jcdm.main.bs.batchInfo.domain.BsBatchInfo;
import com.jcdm.main.bs.batchInfo.service.IBsBatchInfoService;
import com.jcdm.common.utils.poi.ExcelUtil;
import com.jcdm.common.core.page.TableDataInfo;
/**
 * æ‰¹æ¬¡ä¿¡æ¯å½•å…¥Controller
 *
 * @author Yi
 * @date 2024-10-15
 */
@RestController
@RequestMapping("/bs/batchInfo")
public class BsBatchInfoController extends BaseController
{
    @Autowired
    private IBsBatchInfoService bsBatchInfoService;
    /**
     * æŸ¥è¯¢æ‰¹æ¬¡ä¿¡æ¯å½•å…¥åˆ—表
     */
    @PreAuthorize("@ss.hasPermi('bs:batchInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(BsBatchInfo bsBatchInfo)
    {
        startPage();
        List<BsBatchInfo> list = bsBatchInfoService.selectBsBatchInfoList(bsBatchInfo);
        return getDataTable(list);
    }
    /**
     * å¯¼å‡ºæ‰¹æ¬¡ä¿¡æ¯å½•å…¥åˆ—表
     */
    @PreAuthorize("@ss.hasPermi('bs:batchInfo:export')")
    @Log(title = "批次信息录入", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BsBatchInfo bsBatchInfo)
    {
        List<BsBatchInfo> list = bsBatchInfoService.selectBsBatchInfoList(bsBatchInfo);
        ExcelUtil<BsBatchInfo> util = new ExcelUtil<BsBatchInfo>(BsBatchInfo.class);
        util.exportExcel(response, list, "批次信息录入数据");
    }
    /**
     * èŽ·å–批次信息录入详细信息
     */
    @PreAuthorize("@ss.hasPermi('bs:batchInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bsBatchInfoService.selectBsBatchInfoById(id));
    }
    /**
     * æ–°å¢žæ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     */
    @PreAuthorize("@ss.hasPermi('bs:batchInfo:add')")
    @Log(title = "批次信息录入", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BsBatchInfo bsBatchInfo)
    {
        return toAjax(bsBatchInfoService.insertBsBatchInfo(bsBatchInfo));
    }
    /**
     * ä¿®æ”¹æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     */
    @PreAuthorize("@ss.hasPermi('bs:batchInfo:edit')")
    @Log(title = "批次信息录入", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BsBatchInfo bsBatchInfo)
    {
        return toAjax(bsBatchInfoService.updateBsBatchInfo(bsBatchInfo));
    }
    /**
     * åˆ é™¤æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     */
    @PreAuthorize("@ss.hasPermi('bs:batchInfo:remove')")
    @Log(title = "批次信息录入", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bsBatchInfoService.deleteBsBatchInfoByIds(ids));
    }
    @DeleteMapping("/bacthInput/{ids}")
    public AjaxResult bacthInput(@PathVariable Long[] ids)
    {
        return toAjax(bsBatchInfoService.bacthInput(ids));
    }
}
jcdm-main/src/main/java/com/jcdm/main/bs/batchInfo/domain/BsBatchInfo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,139 @@
package com.jcdm.main.bs.batchInfo.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.jcdm.common.annotation.Excel;
import com.jcdm.common.core.domain.BaseEntity;
import java.util.Date;
/**
 * æ‰¹æ¬¡ä¿¡æ¯å½•å…¥å¯¹è±¡ bs_batch_info
 *
 * @author Yi
 * @date 2024-10-15
 */
public class BsBatchInfo extends BaseEntity
{
    private static final long serialVersionUID = 1L;
    /** id */
    private Long id;
    /** ç‰©æ–™ç¼–号 */
    @Excel(name = "物料编号")
    private String materialCode;
    /** ç‰©æ–™åç§° */
    @Excel(name = "物料名称")
    private String materialName;
    /** æ‰¹æ¬¡ */
    @Excel(name = "批次")
    private String batch;
    /** åˆ‡æ¢æ—¶é—´ */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "切换时间")
    private Date changeTime;
    /** å¤‡æ³¨ */
    @Excel(name = "备注")
    private String remarks;
    /** åˆ›å»ºç”¨æˆ· */
    private String createUser;
    /** ä¿®æ”¹ç”¨æˆ· */
    private String updateUser;
    public void setId(Long id)
    {
        this.id = id;
    }
    public Long getId()
    {
        return id;
    }
    public void setMaterialCode(String materialCode)
    {
        this.materialCode = materialCode;
    }
    public String getMaterialCode()
    {
        return materialCode;
    }
    public void setMaterialName(String materialName)
    {
        this.materialName = materialName;
    }
    public String getMaterialName()
    {
        return materialName;
    }
    public void setBatch(String batch)
    {
        this.batch = batch;
    }
    public String getBatch()
    {
        return batch;
    }
    public Date getChangeTime() {
        return changeTime;
    }
    public void setChangeTime(Date changeTime) {
        this.changeTime = changeTime;
    }
    public void setRemarks(String remarks)
    {
        this.remarks = remarks;
    }
    public String getRemarks()
    {
        return remarks;
    }
    public void setCreateUser(String createUser)
    {
        this.createUser = createUser;
    }
    public String getCreateUser()
    {
        return createUser;
    }
    public void setUpdateUser(String updateUser)
    {
        this.updateUser = updateUser;
    }
    public String getUpdateUser()
    {
        return updateUser;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("materialCode", getMaterialCode())
            .append("materialName", getMaterialName())
            .append("batch", getBatch())
            .append("changeTime", getChangeTime())
            .append("remarks", getRemarks())
            .append("createTime", getCreateTime())
            .append("createUser", getCreateUser())
            .append("updateTime", getUpdateTime())
            .append("updateUser", getUpdateUser())
            .toString();
    }
}
jcdm-main/src/main/java/com/jcdm/main/bs/batchInfo/mapper/BsBatchInfoMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.jcdm.main.bs.batchInfo.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jcdm.main.bs.batchInfo.domain.BsBatchInfo;
/**
 * æ‰¹æ¬¡ä¿¡æ¯å½•å…¥Mapper接口
 *
 * @author Yi
 * @date 2024-10-15
 */
public interface BsBatchInfoMapper extends BaseMapper<BsBatchInfo>
{
    /**
     * æŸ¥è¯¢æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param id æ‰¹æ¬¡ä¿¡æ¯å½•å…¥ä¸»é”®
     * @return æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     */
    public BsBatchInfo selectBsBatchInfoById(Long id);
    /**
     * æŸ¥è¯¢æ‰¹æ¬¡ä¿¡æ¯å½•å…¥åˆ—表
     *
     * @param bsBatchInfo æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     * @return æ‰¹æ¬¡ä¿¡æ¯å½•å…¥é›†åˆ
     */
    public List<BsBatchInfo> selectBsBatchInfoList(BsBatchInfo bsBatchInfo);
    /**
     * æ–°å¢žæ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param bsBatchInfo æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     * @return ç»“æžœ
     */
    public int insertBsBatchInfo(BsBatchInfo bsBatchInfo);
    /**
     * ä¿®æ”¹æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param bsBatchInfo æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     * @return ç»“æžœ
     */
    public int updateBsBatchInfo(BsBatchInfo bsBatchInfo);
    /**
     * åˆ é™¤æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param id æ‰¹æ¬¡ä¿¡æ¯å½•å…¥ä¸»é”®
     * @return ç»“æžœ
     */
    public int deleteBsBatchInfoById(Long id);
    /**
     * æ‰¹é‡åˆ é™¤æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param ids éœ€è¦åˆ é™¤çš„数据主键集合
     * @return ç»“æžœ
     */
    public int deleteBsBatchInfoByIds(Long[] ids);
}
jcdm-main/src/main/java/com/jcdm/main/bs/batchInfo/service/IBsBatchInfoService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,65 @@
package com.jcdm.main.bs.batchInfo.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jcdm.main.bs.batchInfo.domain.BsBatchInfo;
/**
 * æ‰¹æ¬¡ä¿¡æ¯å½•å…¥Service接口
 *
 * @author Yi
 * @date 2024-10-15
 */
public interface IBsBatchInfoService extends IService<BsBatchInfo>
{
    /**
     * æŸ¥è¯¢æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param id æ‰¹æ¬¡ä¿¡æ¯å½•å…¥ä¸»é”®
     * @return æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     */
    public BsBatchInfo selectBsBatchInfoById(Long id);
    /**
     * æŸ¥è¯¢æ‰¹æ¬¡ä¿¡æ¯å½•å…¥åˆ—表
     *
     * @param bsBatchInfo æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     * @return æ‰¹æ¬¡ä¿¡æ¯å½•å…¥é›†åˆ
     */
    public List<BsBatchInfo> selectBsBatchInfoList(BsBatchInfo bsBatchInfo);
    /**
     * æ–°å¢žæ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param bsBatchInfo æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     * @return ç»“æžœ
     */
    public int insertBsBatchInfo(BsBatchInfo bsBatchInfo);
    /**
     * ä¿®æ”¹æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param bsBatchInfo æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     * @return ç»“æžœ
     */
    public int updateBsBatchInfo(BsBatchInfo bsBatchInfo);
    /**
     * æ‰¹é‡åˆ é™¤æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param ids éœ€è¦åˆ é™¤çš„批次信息录入主键集合
     * @return ç»“æžœ
     */
    public int deleteBsBatchInfoByIds(Long[] ids);
    /**
     * åˆ é™¤æ‰¹æ¬¡ä¿¡æ¯å½•å…¥ä¿¡æ¯
     *
     * @param id æ‰¹æ¬¡ä¿¡æ¯å½•å…¥ä¸»é”®
     * @return ç»“æžœ
     */
    public int deleteBsBatchInfoById(Long id);
    int bacthInput(Long[] ids);
}
jcdm-main/src/main/java/com/jcdm/main/bs/batchInfo/service/impl/BsBatchInfoServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,147 @@
package com.jcdm.main.bs.batchInfo.service.impl;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jcdm.common.utils.DateUtils;
import com.jcdm.main.bs.beatSetting.domain.BsBeatSetting;
import com.jcdm.main.bs.beatSetting.mapper.BsBeatSettingMapper;
import com.jcdm.main.bs.beatSetting.service.IBsBeatSettingService;
import com.jcdm.main.constant.Constants;
import com.jcdm.main.restful.qingYan.doman.ChildVO;
import com.jcdm.main.restful.qingYan.doman.ParentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jcdm.main.bs.batchInfo.mapper.BsBatchInfoMapper;
import com.jcdm.main.bs.batchInfo.domain.BsBatchInfo;
import com.jcdm.main.bs.batchInfo.service.IBsBatchInfoService;
/**
 * æ‰¹æ¬¡ä¿¡æ¯å½•å…¥Service业务层处理
 *
 * @author Yi
 * @date 2024-10-15
 */
@Service
public class BsBatchInfoServiceImpl extends ServiceImpl<BsBatchInfoMapper, BsBatchInfo> implements IBsBatchInfoService
{
    @Autowired
    private BsBatchInfoMapper bsBatchInfoMapper;
    /**
     * æŸ¥è¯¢æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param id æ‰¹æ¬¡ä¿¡æ¯å½•å…¥ä¸»é”®
     * @return æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     */
    @Override
    public BsBatchInfo selectBsBatchInfoById(Long id)
    {
        return bsBatchInfoMapper.selectBsBatchInfoById(id);
    }
    /**
     * æŸ¥è¯¢æ‰¹æ¬¡ä¿¡æ¯å½•å…¥åˆ—表
     *
     * @param bsBatchInfo æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     * @return æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     */
    @Override
    public List<BsBatchInfo> selectBsBatchInfoList(BsBatchInfo bsBatchInfo)
    {
        return bsBatchInfoMapper.selectBsBatchInfoList(bsBatchInfo);
    }
    /**
     * æ–°å¢žæ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param bsBatchInfo æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     * @return ç»“æžœ
     */
    @Override
    public int insertBsBatchInfo(BsBatchInfo bsBatchInfo)
    {
        bsBatchInfo.setChangeTime(DateUtils.getNowDate());
        bsBatchInfo.setCreateTime(DateUtils.getNowDate());
        return bsBatchInfoMapper.insertBsBatchInfo(bsBatchInfo);
    }
    /**
     * ä¿®æ”¹æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param bsBatchInfo æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     * @return ç»“æžœ
     */
    @Override
    public int updateBsBatchInfo(BsBatchInfo bsBatchInfo)
    {
        bsBatchInfo.setUpdateTime(DateUtils.getNowDate());
        return bsBatchInfoMapper.updateBsBatchInfo(bsBatchInfo);
    }
    /**
     * æ‰¹é‡åˆ é™¤æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
     *
     * @param ids éœ€è¦åˆ é™¤çš„批次信息录入主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteBsBatchInfoByIds(Long[] ids)
    {
        return bsBatchInfoMapper.deleteBsBatchInfoByIds(ids);
    }
    /**
     * åˆ é™¤æ‰¹æ¬¡ä¿¡æ¯å½•å…¥ä¿¡æ¯
     *
     * @param id æ‰¹æ¬¡ä¿¡æ¯å½•å…¥ä¸»é”®
     * @return ç»“æžœ
     */
    @Override
    public int deleteBsBatchInfoById(Long id)
    {
        return bsBatchInfoMapper.deleteBsBatchInfoById(id);
    }
    @Override
    public int bacthInput(Long[] ids) {
        Integer sendData = 0;
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Set<Long> idSet = new HashSet<>(Arrays.asList(ids));
        List<BsBatchInfo> bsBatchInfos = this.listByIds(idSet);
        for (BsBatchInfo bsBatchInfo : bsBatchInfos) {
            ParentVO parentVO = new ParentVO();
            parentVO.setSiteCode("3983");
            parentVO.setRecordId(String.valueOf(Instant.now().toEpochMilli()));
            parentVO.setStationCode("OP165");
            parentVO.setProductNum(format.format(new Date()));
            parentVO.setTotalResult("1");
            List<ChildVO> listChildVo = new ArrayList<>();
            ChildVO childVO = new ChildVO();
            childVO.setItemCode(bsBatchInfo.getMaterialCode());
            childVO.setItemType("3");
            childVO.setItemText(bsBatchInfo.getMaterialName());
            childVO.setItemValue(bsBatchInfo.getBatch());
            childVO.setCheckResult("1");
            childVO.setCheckTime(format.format(new Date()));
            listChildVo.add(childVO);
            parentVO.setCheckList(listChildVo);
            try{
                CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> {
                    HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_GET_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute();
                    System.out.println(execute.body());
                });
            }catch (Exception e){
                System.out.println(e.getMessage());
            }
            sendData = sendData+1;
        }
        return sendData;
    }
}
jcdm-main/src/main/resources/mapper/bs/batchInfo/BsBatchInfoMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,92 @@
<?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.jcdm.main.bs.batchInfo.mapper.BsBatchInfoMapper">
    <resultMap type="BsBatchInfo" id="BsBatchInfoResult">
        <result property="id"    column="id"    />
        <result property="materialCode"    column="material_code"    />
        <result property="materialName"    column="material_name"    />
        <result property="batch"    column="batch"    />
        <result property="changeTime"    column="change_time"    />
        <result property="remarks"    column="remarks"    />
        <result property="createTime"    column="create_time"    />
        <result property="createUser"    column="create_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateUser"    column="update_user"    />
    </resultMap>
    <sql id="selectBsBatchInfoVo">
        select id, material_code, material_name, batch, change_time, remarks, create_time, create_user, update_time, update_user from bs_batch_info
    </sql>
    <select id="selectBsBatchInfoList" parameterType="BsBatchInfo" resultMap="BsBatchInfoResult">
        <include refid="selectBsBatchInfoVo"/>
        <where>
            <if test="materialCode != null  and materialCode != ''"> and material_code = #{materialCode}</if>
            <if test="materialName != null  and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
            <if test="batch != null  and batch != ''"> and batch = #{batch}</if>
        </where>
    </select>
    <select id="selectBsBatchInfoById" parameterType="Long" resultMap="BsBatchInfoResult">
        <include refid="selectBsBatchInfoVo"/>
        where id = #{id}
    </select>
    <insert id="insertBsBatchInfo" parameterType="BsBatchInfo">
        insert into bs_batch_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="materialCode != null">material_code,</if>
            <if test="materialName != null">material_name,</if>
            <if test="batch != null">batch,</if>
            <if test="changeTime != null">change_time,</if>
            <if test="remarks != null">remarks,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createUser != null">create_user,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateUser != null">update_user,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="materialCode != null">#{materialCode},</if>
            <if test="materialName != null">#{materialName},</if>
            <if test="batch != null">#{batch},</if>
            <if test="changeTime != null">#{changeTime},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateUser != null">#{updateUser},</if>
         </trim>
    </insert>
    <update id="updateBsBatchInfo" parameterType="BsBatchInfo">
        update bs_batch_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="materialCode != null">material_code = #{materialCode},</if>
            <if test="materialName != null">material_name = #{materialName},</if>
            <if test="batch != null">batch = #{batch},</if>
            <if test="changeTime != null">change_time = #{changeTime},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
        </trim>
        where id = #{id}
    </update>
    <delete id="deleteBsBatchInfoById" parameterType="Long">
        delete from bs_batch_info where id = #{id}
    </delete>
    <delete id="deleteBsBatchInfoByIds" parameterType="String">
        delete from bs_batch_info where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
jcdm-ui/src/api/main/bs/batchInfo/batchInfo.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,52 @@
import request from '@/utils/request'
// æŸ¥è¯¢æ‰¹æ¬¡ä¿¡æ¯å½•å…¥åˆ—表
export function listBatchInfo(query) {
  return request({
    url: '/bs/batchInfo/list',
    method: 'get',
    params: query
  })
}
// æŸ¥è¯¢æ‰¹æ¬¡ä¿¡æ¯å½•å…¥è¯¦ç»†
export function getBatchInfo(id) {
  return request({
    url: '/bs/batchInfo/' + id,
    method: 'get'
  })
}
// æ–°å¢žæ‰¹æ¬¡ä¿¡æ¯å½•å…¥
export function addBatchInfo(data) {
  return request({
    url: '/bs/batchInfo',
    method: 'post',
    data: data
  })
}
// ä¿®æ”¹æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
export function updateBatchInfo(data) {
  return request({
    url: '/bs/batchInfo',
    method: 'put',
    data: data
  })
}
// åˆ é™¤æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
export function delBatchInfo(id) {
  return request({
    url: '/bs/batchInfo/' + id,
    method: 'delete'
  })
}
// åˆ é™¤æ‰¹æ¬¡ä¿¡æ¯å½•å…¥
export function batchInput(id) {
  return request({
    url: '/bs/batchInfo/bacthInput/' + id,
    method: 'delete'
  })
}
jcdm-ui/src/views/main/bs/batchInfo/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,324 @@
<template>
  <div class="app-container">
    <el-card class="box-card">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
          <el-form-item label="物料编号" prop="materialCode">
            <el-input
              v-model="queryParams.materialCode"
              placeholder="请输入物料编号"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="物料名称" prop="materialName">
            <el-input
              v-model="queryParams.materialName"
              placeholder="请输入物料名称"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="批次" prop="batch">
            <el-input
              v-model="queryParams.batch"
              placeholder="请输入批次"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item style="float: right">
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
    </el-card>
    <el-card style="margin-top: 10px" class="box-card">
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['bs:batchInfo:add']"
            >新增</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['bs:batchInfo:edit']"
            >修改</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDelete"
              v-hasPermi="['bs:batchInfo:remove']"
            >删除</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="batchInput"
            >批次录入</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handleExport"
              v-hasPermi="['bs:batchInfo:export']"
            >导出</el-button>
          </el-col>
          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>
        <el-table border v-loading="loading" :data="batchInfoList" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="物料编号" align="center" prop="materialCode">
          </el-table-column>
          <el-table-column label="物料名称" align="center" prop="materialName">
          </el-table-column>
          <el-table-column label="批次" align="center" prop="batch">
          </el-table-column>
          <el-table-column label="切换时间" align="center" prop="changeTime">
          </el-table-column>
          <el-table-column label="备注" align="center" prop="remarks">
          </el-table-column>
          <el-table-column width="200" label="操作" align="center" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="success"
                plain
                style="width: 72px"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['bs:batchInfo:edit']"
              >修改</el-button>
              <el-button
                size="mini"
                type="danger"
                plain
                style="width: 72px"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['bs:batchInfo:remove']"
              >删除</el-button>
            </template>
          </el-table-column>
        </el-table>
    </el-card>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- æ·»åŠ æˆ–修改批次信息录入对话框 -->
    <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
      <span slot="title">
        <i class="el-icon-s-order"></i>
        {{titleName}}
      </span>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="物料编号" prop="materialCode">
          <el-input v-model="form.materialCode" placeholder="请输入物料编号" />
        </el-form-item>
        <el-form-item label="物料名称" prop="materialName">
          <el-input v-model="form.materialName" placeholder="请输入物料名称" />
        </el-form-item>
        <el-form-item label="批次" prop="batch">
          <el-input v-model="form.batch" placeholder="请输入批次" />
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" placeholder="请输入备注" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">ç¡® å®š</el-button>
        <el-button @click="cancel">取 æ¶ˆ</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listBatchInfo, getBatchInfo, delBatchInfo, addBatchInfo, updateBatchInfo, batchInput } from "@/api/main/bs/batchInfo/batchInfo";
export default {
  name: "BatchInfo",
  data() {
    return {
      // é®ç½©å±‚
      loading: true,
      titleName: "",
      // é€‰ä¸­æ•°ç»„
      ids: [],
      // éžå•ä¸ªç¦ç”¨
      single: true,
      // éžå¤šä¸ªç¦ç”¨
      multiple: true,
      // æ˜¾ç¤ºæœç´¢æ¡ä»¶
      showSearch: true,
      // æ€»æ¡æ•°
      total: 0,
      // æ‰¹æ¬¡ä¿¡æ¯å½•å…¥è¡¨æ ¼æ•°æ®
      batchInfoList: [],
      // å¼¹å‡ºå±‚标题
      title: "",
      // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚
      open: false,
      // æŸ¥è¯¢å‚æ•°
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        materialCode: null,
        materialName: null,
        batch: null,
      },
      // è¡¨å•å‚æ•°
      form: {},
      // è¡¨å•æ ¡éªŒ
      rules: {
        id: [
          { required: true, message: "id不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** æŸ¥è¯¢æ‰¹æ¬¡ä¿¡æ¯å½•å…¥åˆ—表 */
    getList() {
      this.loading = true;
      listBatchInfo(this.queryParams).then(response => {
        this.batchInfoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // å–消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // è¡¨å•é‡ç½®
    reset() {
      this.form = {
        id: null,
        materialCode: null,
        materialName: null,
        batch: null,
        changeTime: null,
        remarks: null,
        createTime: null,
        createUser: null,
        updateTime: null,
        updateUser: null
      };
      this.resetForm("form");
    },
    /** æœç´¢æŒ‰é’®æ“ä½œ */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** é‡ç½®æŒ‰é’®æ“ä½œ */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // å¤šé€‰æ¡†é€‰ä¸­æ•°æ®
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** æ–°å¢žæŒ‰é’®æ“ä½œ */
    handleAdd() {
      this.reset();
      this.open = true;
      this.titleName = "添加批次信息录入";
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getBatchInfo(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.titleName = "修改批次信息录入";
      });
    },
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateBatchInfo(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addBatchInfo(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** åˆ é™¤æŒ‰é’®æ“ä½œ */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除批次信息录入编号为"' + ids + '"的数据项?').then(function() {
        return delBatchInfo(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** åˆ é™¤æŒ‰é’®æ“ä½œ */
    batchInput(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除批次信息录入编号为"' + ids + '"的数据项?').then(function() {
        return batchInput(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("录入成功");
      }).catch(() => {});
    },
    /** å¯¼å‡ºæŒ‰é’®æ“ä½œ */
    handleExport() {
      this.download('bs/batchInfo/export', {
        ...this.queryParams
      }, `batchInfo_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>