guoyujia 10 сар өмнө
parent
commit
3243fc1b8d

+ 156 - 0
src/main/java/cn/ezhizao/project/business/product/controller/BizDayworkItemExamineController.java

@@ -0,0 +1,156 @@
+package cn.ezhizao.project.business.product.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.ezhizao.common.utils.poi.ExcelUtil;
+import cn.ezhizao.framework.aspectj.lang.annotation.Log;
+import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
+import cn.ezhizao.framework.web.controller.BaseController;
+import cn.ezhizao.framework.web.domain.AjaxResult;
+import cn.ezhizao.framework.web.page.TableDataInfo;
+import cn.ezhizao.project.business.product.domain.BizDaywork;
+import cn.ezhizao.project.business.product.domain.BizDayworkItemExamine;
+import cn.ezhizao.project.business.product.service.IBizDayworkItemExamineService;
+import cn.ezhizao.project.business.product.service.IBizDayworkService;
+import org.springframework.security.access.prepost.PreAuthorize;
+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;
+
+
+/**
+ * 分选包装审核申请Controller
+ *
+ * @author ezhizao
+ * @date 2024-07-29
+ */
+@RestController
+@RequestMapping("/business/examine")
+public class BizDayworkItemExamineController extends BaseController
+{
+    @Resource
+    private IBizDayworkItemExamineService bizDayworkItemExamineService;
+    @Resource
+    private IBizDayworkService bizDayworkService;
+
+    /**
+     * 查询分选包装审核申请列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(BizDayworkItemExamine bizDayworkItemExamine) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizDayworkItemExamine);
+        startPage();
+        List<BizDayworkItemExamine> list = bizDayworkItemExamineService.getList(bizDayworkItemExamine);
+        return getDataTable(list);
+    }
+    @GetMapping("/getExamineByDayworkId")
+    public AjaxResult getExamineByDayworkId(BizDayworkItemExamine bizDayworkItemExamine) throws NoSuchFieldException, IllegalAccessException
+    {
+        List<BizDayworkItemExamine> examine = bizDayworkItemExamineService.query().in("daywork_id", bizDayworkItemExamine.getDayworkIds()).list();
+        List<BizDaywork> dayworkList = bizDayworkService.query().in("id", bizDayworkItemExamine.getDayworkIds()).list();
+        if(examine.size() == 0) {
+            String msg = dayworkList.stream().map(BizDaywork::getLotCode).collect(Collectors.joining(","));
+            return error("批次"+msg+"没有提出审核申请,请联系管理员添加");
+        }else {
+            List<Long> examineDayworkIds = examine.stream().map(BizDayworkItemExamine::getDayworkId).collect(Collectors.toList());
+            List<BizDaywork> notDaywork = new ArrayList<>();
+            //判断一箱多批的情况,是否存在一个提申请,一个没提申请
+            bizDayworkItemExamine.getDayworkIds().forEach(item ->{
+                if(!examineDayworkIds.contains(item)) {
+                    notDaywork.add(dayworkList.stream().filter(info -> info.getId().equals(item)).collect(Collectors.toList()).get(0));
+                }
+            });
+            if(notDaywork.size() > 0) {
+                String msg = notDaywork.stream().map(BizDaywork::getLotCode).collect(Collectors.joining(","));
+                return error("批次"+msg+"未提审核申请,请联系管理员添加");
+            }
+            List<BizDayworkItemExamine> collect = examine.stream().filter(item -> item.getStatus().equals(2) ).collect(Collectors.toList());
+            if(collect.size() == 0) {
+                String msg = examine.stream().map(BizDayworkItemExamine::getLotCode).collect(Collectors.joining(","));
+                return error("批次"+msg+"审核尚未通过,请联系管理员");
+            }else {
+                List<BizDayworkItemExamine> notExamine = new ArrayList<>();
+                //判断是否存在一个申请通过,一个未通过
+                examine.forEach(item ->{
+                    if(!item.getStatus().equals(2)){
+                        notExamine.add(item);
+                    }
+                });
+                if(notExamine.size() > 0) {
+                    String msg = notExamine.stream().map(BizDayworkItemExamine::getLotCode).collect(Collectors.joining(","));
+                    return error("批次"+msg+"审核未通过,请联系管理员");
+                }
+                return success();
+            }
+        }
+    }
+
+    /**
+     * 导出分选包装审核申请列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:examine:export')")
+    @Log(title = "分选包装审核申请", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BizDayworkItemExamine bizDayworkItemExamine) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizDayworkItemExamine);
+        List<BizDayworkItemExamine> list = bizDayworkItemExamineService.getList(bizDayworkItemExamine);
+        ExcelUtil<BizDayworkItemExamine> util = new ExcelUtil<BizDayworkItemExamine>(BizDayworkItemExamine.class);
+        util.exportExcel(response, list, "分选包装审核申请数据");
+    }
+
+    /**
+     * 获取分选包装审核申请详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('business:examine:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(bizDayworkItemExamineService.getById(id));
+    }
+
+    /**
+     * 新增分选包装审核申请
+     */
+    @PreAuthorize("@ss.hasPermi('business:examine:add')")
+    @Log(title = "分选包装审核申请", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody BizDayworkItemExamine bizDayworkItemExamine) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizDayworkItemExamine);
+        return toAjax(bizDayworkItemExamineService.save(bizDayworkItemExamine));
+    }
+
+    /**
+     * 修改分选包装审核申请
+     */
+    @PreAuthorize("@ss.hasPermi('business:examine:edit')")
+    @Log(title = "分选包装审核申请", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody BizDayworkItemExamine bizDayworkItemExamine) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizDayworkItemExamine);
+        return toAjax(bizDayworkItemExamineService.updateById(bizDayworkItemExamine));
+    }
+
+    /**
+     * 删除分选包装审核申请
+     */
+    @PreAuthorize("@ss.hasPermi('business:examine:remove')")
+    @Log(title = "分选包装审核申请", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable List<Long> ids)
+    {
+        return toAjax(bizDayworkItemExamineService.removeBatchByIds(ids));
+    }
+}

+ 89 - 0
src/main/java/cn/ezhizao/project/business/product/domain/BizDayworkItemExamine.java

@@ -0,0 +1,89 @@
+package cn.ezhizao.project.business.product.domain;
+
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+/**
+ * 分选包装审核申请对象 biz_daywork_item_examine
+ *
+ * @author ezhizao
+ * @date 2024-07-29
+ */
+@Data
+@TableName(value = "biz_daywork_item_examine")
+public class BizDayworkItemExamine extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 租户(厂别)id */
+    @ApiModelProperty(value = "${comment}")
+    private Long tenantId;
+
+    /** daywork的id */
+    @ApiModelProperty(value = "${comment}")
+    private Long dayworkId;
+
+    /** 报工明细id */
+    @ApiModelProperty(value = "${comment}")
+    private Long dayworkItemId;
+
+    /** 工段id */
+    @ApiModelProperty(value = "${comment}")
+    private Long deptId;
+
+    /** 计划单明细id */
+    @ApiModelProperty(value = "${comment}")
+    private Long productionPlanDetailId;
+
+    /** 产品描述 */
+    @Excel(name = "产品描述")
+    @ApiModelProperty(value = "产品描述")
+    private String productDescription;
+
+    /** 批次id */
+    @ApiModelProperty(value = "${comment}")
+    private Long lotId;
+
+    /** 批次号 */
+    @Excel(name = "批次号")
+    @ApiModelProperty(value = "批次号")
+    private String lotCode;
+
+    /** 产品id */
+    @ApiModelProperty(value = "批次号")
+    private Long productId;
+
+    /** 工艺id(通过工艺id,获取版本号) */
+    @ApiModelProperty(value = "批次号")
+    private Long technologicalProcessId;
+
+    /** 当前工序id */
+    @ApiModelProperty(value = "批次号")
+    private Long technologicalProcessDetailId;
+
+    /** 工序id */
+    @ApiModelProperty(value = "批次号")
+    private Long processId;
+
+    /** 工序简称 */
+    @Excel(name = "工序简称")
+    @ApiModelProperty(value = "工序简称")
+    private String processAlias;
+
+    /** 审核状态 0待确认 2通过 1不通过 */
+    @Excel(name = "审核状态 0待确认 2通过 1不通过")
+    @ApiModelProperty(value = "审核状态 0待确认 2通过 1不通过")
+    private Integer status;
+
+    /** 审核人id */
+    @ApiModelProperty(value = "审核状态 0待确认 2通过 1不通过")
+    private Long reviewerId;
+    @TableField(exist = false)
+    private List<Long> dayworkIds;
+}

+ 31 - 0
src/main/java/cn/ezhizao/project/business/product/mapper/BizDayworkItemExamineMapper.java

@@ -0,0 +1,31 @@
+package cn.ezhizao.project.business.product.mapper;
+
+import java.util.List;
+
+import cn.ezhizao.project.business.product.domain.BizDayworkItemExamine;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+
+/**
+ * 分选包装审核申请Mapper接口
+ *
+ * @author ezhizao
+ * @date 2024-07-29
+ */
+public interface BizDayworkItemExamineMapper extends BaseMapper<BizDayworkItemExamine>
+{
+    /**
+     * 查询分选包装审核申请列表
+     *
+     * @param bizDayworkItemExamine 分选包装审核申请
+     * @return 分选包装审核申请集合
+     */
+    public List<BizDayworkItemExamine> getList(BizDayworkItemExamine bizDayworkItemExamine);
+
+    /**
+     * 物理删除
+     * @param bizDayworkItemExamine
+     * @return 删除结果
+    */
+    public int physicalDelete(BizDayworkItemExamine bizDayworkItemExamine);
+}

+ 32 - 0
src/main/java/cn/ezhizao/project/business/product/service/IBizDayworkItemExamineService.java

@@ -0,0 +1,32 @@
+package cn.ezhizao.project.business.product.service;
+
+import java.util.List;
+
+import cn.ezhizao.project.business.product.domain.BizDayworkItemExamine;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+
+/**
+ * 分选包装审核申请Service接口
+ *
+ * @author ezhizao
+ * @date 2024-07-29
+ */
+public interface IBizDayworkItemExamineService extends IService<BizDayworkItemExamine>
+{
+    /**
+     * 查询分选包装审核申请列表
+     *
+     * @param bizDayworkItemExamine 分选包装审核申请
+     * @return 分选包装审核申请集合
+     */
+    public List<BizDayworkItemExamine> getList(BizDayworkItemExamine bizDayworkItemExamine);
+
+    /**
+     * 物理删除
+     * @param bizDayworkItemExamine
+     * @return 删除结果
+     */
+    public int physicalDelete(BizDayworkItemExamine bizDayworkItemExamine);
+
+}

+ 45 - 0
src/main/java/cn/ezhizao/project/business/product/service/impl/BizDayworkItemExamineServiceImpl.java

@@ -0,0 +1,45 @@
+package cn.ezhizao.project.business.product.service.impl;
+
+import java.util.List;
+import javax.annotation.Resource;
+
+import cn.ezhizao.project.business.product.domain.BizDayworkItemExamine;
+import cn.ezhizao.project.business.product.mapper.BizDayworkItemExamineMapper;
+import cn.ezhizao.project.business.product.service.IBizDayworkItemExamineService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * 分选包装审核申请Service业务层处理
+ *
+ * @author ezhizao
+ * @date 2024-07-29
+ */
+@Service
+public class BizDayworkItemExamineServiceImpl  extends ServiceImpl<BizDayworkItemExamineMapper, BizDayworkItemExamine> implements IBizDayworkItemExamineService
+{
+    @Resource
+    private BizDayworkItemExamineMapper bizDayworkItemExamineMapper;
+
+    /**
+     * 查询分选包装审核申请列表
+     *
+     * @param bizDayworkItemExamine 分选包装审核申请
+     * @return 分选包装审核申请
+     */
+    @Override
+    public List<BizDayworkItemExamine> getList(BizDayworkItemExamine bizDayworkItemExamine)
+    {
+        return bizDayworkItemExamineMapper.getList(bizDayworkItemExamine);
+    }
+
+    /**
+     * 物理删除
+     * @param bizDayworkItemExamine
+     * @return 删除结果
+     */
+    @Override
+    public int physicalDelete(BizDayworkItemExamine bizDayworkItemExamine){ return bizDayworkItemExamineMapper.physicalDelete(bizDayworkItemExamine); };
+
+}

+ 31 - 0
src/main/resources/mybatis/business/product/BizDayworkItemExamineMapper.xml

@@ -0,0 +1,31 @@
+<?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="cn.ezhizao.project.business.product.mapper.BizDayworkItemExamineMapper">
+
+    <resultMap type="cn.ezhizao.project.business.product.domain.BizDayworkItemExamine" id="BizDayworkItemExamineResult">
+        <id column="id" property="id"/>
+    </resultMap>
+
+
+    <select id="getList" parameterType="BizDayworkItemExamine" resultMap="BizDayworkItemExamineResult">
+        SELECT * FROM biz_daywork_item_examine
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            deleted = 0
+            <if test="lotCode != null  and lotCode != ''"> AND lot_code = #{lotCode}</if>
+            <if test="processAlias != null  and processAlias != ''"> AND process_alias = #{processAlias}</if>
+            <if test="status != null "> AND status = #{status}</if>
+        </trim>
+    </select>
+
+    <delete id="physicalDelete">
+        DELETE FROM biz_daywork_item_examine
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            <if test="id != null">
+                id = #{id} AND
+            </if>
+       <!-- 删除条件为其他外键可以在这里加 -->
+        </trim>
+    </delete>
+</mapper>